Repository navigation
121 lines (121 loc) · 4.09 KB
/
Copy pathci.yml
File metadata and controls
121 lines (121 loc) · 4.09 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
name: Build and publish jMonkeyEngine Native Bootstrap
on:
push:
branches: ['**']
release:
types: [published]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
version:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.version.outputs.release-version }}
steps:
- name: Validate release version
id: version
shell: bash
run: |
if [[ "$GITHUB_EVENT_NAME" == release ]]; then
version="${GITHUB_REF_NAME#v}"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Expected release tag MAJOR.MINOR.PATCH or vMAJOR.MINOR.PATCH'; exit 1; }
echo "release-version=$version" >> "$GITHUB_OUTPUT"
fi
test:
needs: version
name: ${{ matrix.os }} / Java ${{ matrix.java }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
java: ['8', '11', '21']
include:
- os: windows-11-arm
java: '17'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
if: matrix.os != 'windows-11-arm'
with:
distribution: zulu
java-version: |
8
11
21
- uses: actions/setup-java@v5
if: matrix.os == 'windows-11-arm'
with:
distribution: microsoft
java-version: |
17
21
- uses: gradle/actions/setup-gradle@v5
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
arch: ${{ matrix.os == 'windows-11-arm' && 'amd64_arm64' || 'x64' }}
- name: Prepare Linux noexec fixture
if: runner.os == 'Linux'
shell: bash
run: |
sudo mkdir -p /mnt/native-bootstrap-noexec
sudo mount -t tmpfs -o noexec,mode=1777 tmpfs /mnt/native-bootstrap-noexec
echo 'NATIVE_BOOTSTRAP_NOEXEC_ROOT=/mnt/native-bootstrap-noexec' >> "$GITHUB_ENV"
- name: Build, test real JNI and prepare artifacts
shell: bash
env:
RELEASE_VERSION: ${{ needs.version.outputs.release-version }}
run: |
args=(-PtestJavaVersion=${{ matrix.java }})
tasks=(build)
if [[ -n "$RELEASE_VERSION" ]]; then
args+=(-PreleaseVersion="$RELEASE_VERSION")
else
tasks+=(stageMavenArtifacts)
fi
./gradlew --no-daemon "${tasks[@]}" "${args[@]}"
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v6
with:
name: tests-${{ matrix.os }}-java-${{ matrix.java }}
path: '**/build/reports/tests/'
- name: Unmount Linux fixture
if: always() && runner.os == 'Linux'
shell: bash
run: sudo umount /mnt/native-bootstrap-noexec || true
publish:
needs: [version, test]
if: github.event_name == 'release' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'))
runs-on: ubuntu-latest
environment: sonatype-central
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v5
- name: Publish to Maven Central
shell: bash
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
RELEASE_VERSION: ${{ needs.version.outputs.release-version }}
run: |
for secret in SIGNING_KEY SIGNING_PASSWORD CENTRAL_USERNAME CENTRAL_PASSWORD; do
if [[ -z "${!secret}" ]]; then
echo "::error::Missing required secret: $secret"
exit 1
fi
done
if [[ -n "$RELEASE_VERSION" ]]; then
./gradlew --no-daemon mavenCentralDeploy -PreleaseVersion="$RELEASE_VERSION"
else
./gradlew --no-daemon mavenCentralDeploy
fi