|
1 | | -# this build is designed to replicate the Travis CI workflow |
2 | | -name: Build with Maven |
| 1 | +name: Java CI with Maven |
3 | 2 |
|
4 | 3 | on: |
5 | 4 | push: |
6 | | - branches: [ master ] |
| 5 | + branches: [ "master" ] |
7 | 6 | pull_request: |
8 | | - branches: [ master ] |
9 | | - workflow_dispatch: |
| 7 | + branches: [ "master" ] |
10 | 8 |
|
11 | 9 | jobs: |
12 | 10 | build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
13 | 13 | strategy: |
14 | 14 | matrix: |
15 | | - platform: [ ubuntu-latest ] |
16 | | - java-version: [ 21 ] |
17 | | - |
18 | | - runs-on: ${{ matrix.platform }} |
19 | | - env: |
20 | | - PLATFORM: ${{ matrix.platform }} |
21 | | - JAVA_VERSION: ${{ matrix.java-version }} |
| 15 | + java: [8, 11, 21] |
22 | 16 |
|
23 | 17 | steps: |
24 | | - - uses: actions/checkout@v2 |
25 | | - - name: Set up JDK |
26 | | - uses: actions/setup-java@v1 |
27 | | - with: |
28 | | - java-version: ${{ matrix.java-version }} |
29 | | - - name: Cache local Maven repository |
30 | | - uses: actions/cache@v3 |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Set up JDK ${{ matrix.java }} |
| 21 | + uses: actions/setup-java@v3 |
31 | 22 | with: |
32 | | - path: ~/.m2/repository |
33 | | - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
34 | | - restore-keys: | |
35 | | - ${{ runner.os }}-maven- |
36 | | - - name: Install dependencies |
37 | | - run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --file pom.xml |
38 | | - - name: Build with Maven |
39 | | - run: mvn test --batch-mode --file pom.xml |
40 | | - # this is necessary to populate the environment variables for Coveralls properly |
41 | | - - name: Set branch name and PR number |
42 | | - id: refs |
43 | | - continue-on-error: true |
44 | | - env: |
45 | | - BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }} |
46 | | - run: | |
47 | | - echo "::set-output name=branch_name::${BRANCH_NAME_OR_REF#refs/heads/}" |
48 | | - echo "::set-output name=pr_number::$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" |
49 | | - - name: Update coverage |
50 | | - continue-on-error: true |
51 | | - if: ${{ steps.refs.outcome == 'success' }} |
52 | | - env: |
53 | | - CI_NAME: Github |
54 | | - CI_BUILD_NUMBER: ${{ github.run_id }} |
55 | | - CI_BUILD_URL: https://github.com/${{ github.repository }}/commit/${{ github.event.after }}/checks |
56 | | - CI_BRANCH: ${{ steps.refs.outputs.branch_name }} |
57 | | - CI_PULL_REQUEST: ${{ steps.refs.outputs.pr_number }} |
58 | | - run: mvn jacoco:report coveralls:report --batch-mode --file pom.xml --no-transfer-progress -DrepoToken=${{ secrets.COVERALLS_TOKEN }} |
| 23 | + java-version: ${{ matrix.java }} |
| 24 | + distribution: 'adopt' |
| 25 | + cache: maven |
59 | 26 |
|
| 27 | + - name: Build with Maven |
| 28 | + run: mvn clean install --file pom.xml |
0 commit comments