-
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (125 loc) · 4.77 KB
/
ci.yml
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
name: Java CI
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- "**.h"
- "**.c"
- "**.java"
- ".github/workflows/**"
- "**.properties"
- "**.xml"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
architecture: [x86, x64]
exclude:
- os: macos-latest
architecture: x86
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
architecture: ${{ matrix.architecture }}
- name: print Java version
run: java -version
- if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x86')
name: Set up C/C++ compiler
run: |
sudo apt update
sudo apt-get -y install g++-multilib
- if: startsWith(matrix.os, 'windows') && startsWith(matrix.architecture, 'x86')
name: Set up C/C++ compiler and compile, run tests, and build package with Maven (${{ matrix.os }} ${{ matrix.architecture }})
run: |
choco install mingw --x86
$env:PATH = "C:\ProgramData\mingw64\mingw32\bin;" + $env:PATH
./mvnw -B --no-transfer-progress clean test package
- if: ${{ !(startsWith(matrix.os, 'windows') && startsWith(matrix.architecture, 'x86')) }}
name: Compile, run tests, and build package with Maven (${{ matrix.os }} ${{ matrix.architecture }})
run: ./mvnw -B --no-transfer-progress clean test package
- if: github.event_name == 'push' && endsWith(github.event.head_commit.message, 'Update libraries')
name: Push compiled library back to GitHub
run: |
git config user.name "toolfactory"
git config user.email "tool.factory.heads@gmail.com"
git config pull.rebase false
git pull origin ${{github.ref}}
git add .
git commit -am "Update native library: ${{ matrix.os }}-${{ matrix.architecture }}" --allow-empty
git push
test-with-Java-7-and-later:
name: Testing on ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.java }}
needs: [build]
strategy:
fail-fast: false
max-parallel: 15
matrix:
architecture: [x86, x64]
os: [ubuntu-latest, macOS-latest, windows-latest]
java: [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
exclude:
- os: macOS-latest
architecture: x86
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
- name: Update repositories
run: |
git config user.name "toolfactory"
git config user.email "tool.factory.heads@gmail.com"
git config pull.rebase false
git pull origin ${{github.ref}}
- if: endsWith(matrix.java, '-ea') != true
name: Build and test with final version JDK
run: ./mvnw -B --no-transfer-progress clean test -Dproject_jdk_version=${{ matrix.java }} -DskipTests=false -Dmassive_test_mode=enabled
- if: endsWith(matrix.java, '18-ea') == true
name: Build and test with early access version JDK
run: ./mvnw -B clean test -Dproject_jdk_version=18 -DskipTests=false -Dmassive_test_mode=enabled
release:
needs: [test-with-Java-7-and-later]
name: Release if requested
runs-on: ubuntu-latest
if: github.event_name == 'push' && endsWith(github.event.head_commit.message, 'Release new version')
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish to the Maven central repository
run: |
export GPG_TTY=$(tty)
echo "${{ secrets.gpg_private_key }}" | gpg --batch --import
git config user.name "toolfactory"
git config user.email "tool.factory.heads@gmail.com"
git config pull.rebase false
git pull origin ${{github.ref}}
./mvnw -B release:prepare release:perform -Dproject_jdk_version=7 -DskipTests=true \
-Dgpg.passphrase="${{ secrets.gpg_passphrase }}" \
-Dgpg.keyname=${{ secrets.gpg_key_id }} \
-Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git
env:
MAVEN_USERNAME: ${{ secrets.nexus_username }}
MAVEN_PASSWORD: ${{ secrets.nexus_password }}