chore: Add GitHub CI configuration and format code (#2) #10
This file contains hidden or 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: | ||
| - main | ||
| pull_request: | ||
| merge_group: | ||
| jobs: | ||
| test: | ||
| runs-on: ${{ matrix.os }} | ||
| name: test (Java ${{ matrix.java-version }} on ${{ matrix.os-label }}) | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| java-version: [ "8", "11", "17" ] | ||
| os: [ "ubuntu-latest" ] | ||
| os-label: [ "Ubuntu" ] | ||
| include: | ||
| - { java-version: "11", os: "windows-latest", os-label: "Windows" } | ||
| - { java-version: "11", os: "macos-latest", os-label: "macOS" } | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up JDK ${{ matrix.java-version }} | ||
| uses: actions/setup-java@v1 | ||
| with: | ||
|
Check failure on line 28 in .github/workflows/ci.yml
|
||
| java-version: ${{ matrix.java-version }} | ||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
| - name: Code style check | ||
| run: | | ||
| ./gradlew spotlessCheck | ||
| - name: Build and Test | ||
| run: ./gradlew build test | ||
| - name: Generate JaCoCo Report | ||
| run: ./gradlew jacocoTestReport | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./build/reports/jacoco/test/jacocoTestReport.xml | ||
| flags: unittests | ||
| fail_ci_if_error: true | ||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||