CI #466
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |