-
Notifications
You must be signed in to change notification settings - Fork 10
146 lines (139 loc) · 4.6 KB
/
build.yml
File metadata and controls
146 lines (139 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build
on:
push:
branches: [master]
tags: ['native-*']
pull_request:
branches: [master]
workflow_dispatch:
env:
LMDB: lmdb/libraries/liblmdb
jobs:
linux:
strategy:
fail-fast: true
matrix:
# Container versions: rockylinux:8 = glibc 2.28, alpine:3.21 = musl
include:
- { runner: ubuntu-latest, container: "rockylinux:8", artifact: x86_64-linux-gnu.so }
- { runner: ubuntu-24.04-arm, container: "rockylinux:8", artifact: aarch64-linux-gnu.so }
- { runner: ubuntu-latest, container: "alpine:3.21", artifact: x86_64-linux-musl.so }
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
steps:
- name: Install tools
run: |
if command -v dnf >/dev/null; then
dnf install -y gcc make git
elif command -v apk >/dev/null; then
apk add --no-cache build-base git
fi
- uses: actions/checkout@v4
with:
submodules: true
- name: Build and test
run: make test
working-directory: ${{ env.LMDB }}
- name: Prepare artifact
run: cp ${{ env.LMDB }}/liblmdb.so ${{ matrix.artifact }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
retention-days: 1
# ARM64 Alpine (alpine:3.21) requires QEMU because GitHub's JS actions don't run in Alpine on ARM64.
# Tests are skipped because LMDB's MDB_FIXEDMAP doesn't work under QEMU emulation.
linux-arm64-musl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
- name: Build
run: |
docker run --rm -v $PWD:/work -w /work --platform linux/arm64 alpine:3.21 sh -c '
apk add --no-cache build-base
make -C ${{ env.LMDB }}
'
- name: Prepare artifact
run: cp ${{ env.LMDB }}/liblmdb.so aarch64-linux-musl.so
- uses: actions/upload-artifact@v4
with:
name: aarch64-linux-musl.so
path: aarch64-linux-musl.so
retention-days: 1
macos:
strategy:
fail-fast: true
matrix:
include:
- { runner: macos-15-intel, artifact: x86_64-macos-none.so } # Intel available until Aug 2027
- { runner: macos-latest, artifact: aarch64-macos-none.so }
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build and test
run: make test
working-directory: ${{ env.LMDB }}
- name: Prepare artifact
run: cp ${{ env.LMDB }}/liblmdb.so ${{ matrix.artifact }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
retention-days: 1
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: mingw-w64-x86_64-gcc make
- name: Build and test
shell: msys2 {0}
run: make SOEXT=.dll test
working-directory: ${{ env.LMDB }}
- name: Prepare artifact
run: cp ${{ env.LMDB }}/liblmdb.dll x86_64-windows-gnu.dll
- uses: actions/upload-artifact@v4
with:
name: x86_64-windows-gnu.dll
path: x86_64-windows-gnu.dll
retention-days: 1
package:
needs: [linux, linux-arm64-musl, macos, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: target/classes/org/lmdbjava/native
merge-multiple: true
- run: ls -la target/classes/org/lmdbjava/native
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.gpg_private_key }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- run: mvn -B package
- uses: actions/upload-artifact@v4
with:
name: native.jar
path: target/*.jar
- name: Deploy
if: startsWith(github.ref, 'refs/tags/')
run: mvn -B -Pcentral-deploy deploy -DskipTests
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.central_username }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.central_password }}