|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + name: Test (Java ${{ matrix.java }} - ${{ matrix.os }}) |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + timeout-minutes: 10 |
| 16 | + strategy: |
| 17 | + fail-fast: true |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, windows-latest] |
| 20 | + java: [8, 11, 17, 21] |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v6 |
| 25 | + |
| 26 | + - name: Set up JDK ${{ matrix.java }} |
| 27 | + uses: actions/setup-java@v5 |
| 28 | + with: |
| 29 | + java-version: ${{ matrix.java }} |
| 30 | + distribution: 'temurin' |
| 31 | + cache: 'gradle' |
| 32 | + |
| 33 | + - name: Grant execute permission for gradlew |
| 34 | + run: chmod +x gradlew |
| 35 | + if: runner.os != 'Windows' |
| 36 | + |
| 37 | + - name: Build with Gradle |
| 38 | + run: ./gradlew build --no-daemon |
| 39 | + |
| 40 | + - name: Run tests |
| 41 | + run: ./gradlew test --no-daemon |
| 42 | + |
| 43 | + - name: Upload test results |
| 44 | + uses: actions/upload-artifact@v6 |
| 45 | + if: failure() |
| 46 | + with: |
| 47 | + name: test-results-java-${{ matrix.java }}-${{ matrix.os }} |
| 48 | + path: build/reports/tests/test/ |
| 49 | + |
| 50 | + build: |
| 51 | + name: Build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: test |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Checkout code |
| 57 | + uses: actions/checkout@v6 |
| 58 | + |
| 59 | + - name: Set up JDK 17 |
| 60 | + uses: actions/setup-java@v5 |
| 61 | + with: |
| 62 | + java-version: '17' |
| 63 | + distribution: 'temurin' |
| 64 | + cache: 'gradle' |
| 65 | + |
| 66 | + - name: Grant execute permission for gradlew |
| 67 | + run: chmod +x gradlew |
| 68 | + |
| 69 | + - name: Build package |
| 70 | + run: ./gradlew build --no-daemon |
| 71 | + |
| 72 | + - name: Check build output |
| 73 | + run: | |
| 74 | + if [ ! -d "build/libs" ]; then |
| 75 | + echo "Build output directory 'build/libs' not found" |
| 76 | + exit 1 |
| 77 | + fi |
0 commit comments