feat: Travis to GitHub Actions CI #18
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: Build and Test | |
| on: | |
| push: | |
| branches: [ 1.x ] | |
| pull_request: | |
| branches: [ 1.x ] | |
| workflow_dispatch: | |
| # cancel same workflows in progress for pull request branches | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/1.x' }} | |
| jobs: | |
| build: | |
| name: Build with JDK 8 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Display Java version | |
| run: | | |
| java -version | |
| mvn -version | |
| - name: Build with Maven (JDK 8) | |
| run: mvn clean install -DskipTests -B -V | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: maven-build-artifacts | |
| path: | | |
| **/target/*.jar | |
| **/target/classes/ | |
| **/target/test-classes/ | |
| retention-days: 1 | |
| - name: Upload Maven repository | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: maven-repository | |
| path: ~/.m2/repository | |
| retention-days: 1 | |
| test: | |
| name: Test with JDK ${{ matrix.java }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java: ['8', '11', '17'] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: maven-build-artifacts | |
| - name: Download Maven repository | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: maven-repository | |
| path: ~/.m2/repository | |
| - name: Set up JDK ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: 'temurin' | |
| - name: Display Java version | |
| run: | | |
| java -version | |
| mvn -version | |
| - name: Run unit tests with JDK ${{ matrix.java }} | |
| run: mvn test -B -V -Dmaven.main.skip=true | |
| continue-on-error: ${{ matrix.java == '17' }} | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() | |
| with: | |
| files: | | |
| **/target/surefire-reports/TEST-*.xml | |
| check_name: Test Results (JDK ${{ matrix.java }}) | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: test-results-jdk${{ matrix.java }} | |
| path: | | |
| **/target/surefire-reports/ | |
| **/target/failsafe-reports/ | |
| retention-days: 7 |