-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (120 loc) · 3.83 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
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
push:
branches:
- master
schedule:
- cron: '0 10 * * *' # Once per day at 10am UTC
workflow_dispatch:
jobs:
commitlint:
name: Check Commit Message
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check-skip.outputs.skip }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
with:
configFile: package.json
failOnWarnings: true
- name: Skip when release
id: check-skip
env:
COMMIT_FILTER: "^chore: (bump version|release)"
run: |
readonly local last_commit_log=$(git log -1 --pretty=format:"%s")
echo "Last commit log: $last_commit_log"
readonly local filter_count=$(echo "$last_commit_log" | grep -c -E "$COMMIT_FILTER")
if [[ "$filter_count" -gt 0 ]]; then
echo "The last commit log \"$last_commit_log\" contains \"$COMMIT_FILTER\", stopping"
echo "skip=true" >> ${GITHUB_OUTPUT}
fi
build:
name: Build
needs: [commitlint]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
jdk: [8, 11, 21]
fail-fast: false
steps:
- name: Setup redis on MacOS
if: matrix.os == 'macos-latest'
run: |
brew install redis
brew services start redis
- name: Setup redis on Linux
if: matrix.os == 'ubuntu-latest'
run: |
docker run --name redis -p6379:6379 -d redis:7.4.0-alpine
- name: Setup wsl on Windows
if: matrix.os == 'windows-latest'
uses: Vampire/setup-wsl@v3
with:
distribution: Debian
- name: Setup redis on Windows
if: matrix.os == 'windows-latest'
run: |
wsl sudo apt-get update
wsl sudo apt-get install -y redis-server
wsl sudo service redis-server start
- uses: actions/checkout@v4
- name: Setup JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Build with Gradle
env:
redis-host: redis://127.0.0.1:6379
skip_benchmark: true
run: ./gradlew clean build --info
coveralls:
name: Update Coveralls
needs: [build]
runs-on: ubuntu-latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Build with Gradle
run: ./gradlew clean coverage
- name: Update Coveralls
run: ./gradlew coveralls
publish:
name: Publish
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
NEXUS_REPO_PASSWORD: ${{ secrets.NEXUS_REPO_PASSWORD }}
NEXUS_REPO_USERNAME: ${{ secrets.NEXUS_REPO_USERNAME }}
steps:
- uses: actions/checkout@v4
- name: Skip release version
run: |
current_version=$(grep -m1 'version =' gradle.properties | grep -oE '([0-9]+\.[0-9]+\.[0-9]+.*)')
echo "Current version: ${current_version}"
echo "current_version=${current_version}" >> "${GITHUB_ENV}"
- name: Setup JDK
if: "${{ endsWith(env.current_version, '-SNAPSHOT') }}"
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Publish to Nexus
if: "${{ endsWith(env.current_version, '-SNAPSHOT') }}"
run: ./gradlew publish -Dorg.gradle.parallel=false --info