Build, Test, and Release #19
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: Build, Test, and Release | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' # For v1.0, v0.1.0, etc | |
pull_request: | |
branches: | |
- 'main' | |
schedule: | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
concurrency: | |
# Allow concurrent run for main, MR, and tag | |
# Disallow concurrent runs on same MRs, tags, and main (triggered by dispatch, schedule, or push) | |
group: ${{ format('{0}-{1}', github.job, github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
java: [ 17 ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
- name: Grant execute permission for gradlew | |
if: runner.os == 'Linux' | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew assemble --info | |
- name: Upload build results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }} Java ${{ matrix.java }} build results | |
path: ${{ github.workspace }}/build/libs/ | |
test: | |
name: Run unit tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
java: [ 17 ] | |
needs: | |
- build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
- name: Grant execute permission for gradlew | |
if: runner.os == 'Linux' | |
run: chmod +x gradlew | |
- name: Test with Gradle | |
run: ./gradlew check --debug | |
- name: Upload test results | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }} Java ${{ matrix.java }} test results | |
path: ${{ github.workspace }}/build/reports/ |