|
| 1 | +name: Java CI |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + checkstyle: |
| 7 | + name: Run checkstyle with java ${{ matrix.java_version }} |
| 8 | + runs-on: ubuntu-latest |
| 9 | + if: github.event_name == 'pull_request' |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + java_version: ['8'] |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v1 |
| 15 | + - name: Set up JDK ${{ matrix.java_version }} |
| 16 | + uses: actions/setup-java@v1 |
| 17 | + with: |
| 18 | + java-version: ${{ matrix.java_version }} |
| 19 | + - name: Run checkstyle with Maven |
| 20 | + run: mvn --file pom.xml clean verify -Pcheckstyle -Dmaven.test.skip=true -B |
| 21 | + |
| 22 | + test: |
| 23 | + name: Run basic test with java ${{ matrix.java_version }} |
| 24 | + runs-on: ubuntu-latest |
| 25 | + needs: checkstyle |
| 26 | + if: github.event_name == 'pull_request' |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + java_version: ['8', '9', '10', '11', '12', '13'] |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v1 |
| 33 | + - name: Set up JDK ${{ matrix.java_version }} |
| 34 | + uses: actions/setup-java@v1 |
| 35 | + with: |
| 36 | + java-version: ${{ matrix.java_version }} |
| 37 | + - name: Build with Maven |
| 38 | + run: mvn -B package --file pom.xml |
| 39 | + |
| 40 | + integration-test: |
| 41 | + name: Run integration test with java ${{ matrix.java_version }} and Maven ${{ matrix.maven_version }} |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: checkstyle |
| 44 | + if: github.event_name == 'pull_request' |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + java_version: ['8'] |
| 48 | + maven_version: ['3.0', '3.0.5', '3.1.1', '3.2.5', '3.3.9', '3.5.4', '3.6.3'] |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v1 |
| 52 | + - name: Set up JDK ${{ matrix.java_version }} |
| 53 | + uses: actions/setup-java@v1 |
| 54 | + with: |
| 55 | + java-version: ${{ matrix.java_version }} |
| 56 | + - name: Setup Maven ${{ matrix.maven_version }} |
| 57 | + run: /bin/bash -c 'if [[ -n "${{ matrix.maven_version }}" ]]; then \ |
| 58 | + echo "Download Maven ${{ matrix.maven_version }}...."; |
| 59 | + if [[ "${{ matrix.maven_version }}" == "3.0" ]]; then |
| 60 | + wget https://archive.apache.org/dist/maven/binaries/apache-maven-3.0-bin.zip || terminate 1; |
| 61 | + else |
| 62 | + wget https://archive.apache.org/dist/maven/maven-3/${{ matrix.maven_version }}/binaries/apache-maven-${{ matrix.maven_version }}-bin.zip || terminate 1; |
| 63 | + fi; |
| 64 | + unzip -qq apache-maven-${{ matrix.maven_version }}-bin.zip || terminate 1; |
| 65 | + export M2_HOME=$PWD/apache-maven-${{ matrix.maven_version }}; |
| 66 | + export PATH=$M2_HOME/bin:$PATH; |
| 67 | + mvn -version; |
| 68 | + fi' |
| 69 | + - name: Package with Maven |
| 70 | + run: mvn clean package -B |
| 71 | + - name: Install a test version with Maven |
| 72 | + run: mvn clean test install -B |
| 73 | + - name: Run the local testversion with Maven |
| 74 | + run: mvn clean initialize -Pdemo -Dmaven.test.skip=true -B |
| 75 | + - name: Validate if the testversion has produced the desired output |
| 76 | + run: /bin/bash -c '[[ -f maven/target/testing.properties ]] && cat maven/target/testing.properties || exit 1;' |
| 77 | + |
| 78 | + coveralls: |
| 79 | + name: Run coveralls with java ${{ matrix.java_version }} |
| 80 | + runs-on: ubuntu-latest |
| 81 | + needs: integration-test |
| 82 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 83 | + |
| 84 | + strategy: |
| 85 | + matrix: |
| 86 | + java_version: ['8'] |
| 87 | + |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v1 |
| 90 | + - run: git checkout "${GITHUB_REF:11}" |
| 91 | + - name: Set up JDK ${{ matrix.java_version }} |
| 92 | + uses: actions/setup-java@v1 |
| 93 | + with: |
| 94 | + java-version: ${{ matrix.java_version }} |
| 95 | + - name: Run Coveralls with maven |
| 96 | + run: mvn clean test jacoco:report coveralls:report -Pcoveralls -DrepoToken=${{ secrets.CoverallsRepoTokenSecret }} -B |
| 97 | + |
| 98 | + deploy-snapshot: |
| 99 | + name: Run coveralls with java ${{ matrix.java_version }} |
| 100 | + runs-on: ubuntu-latest |
| 101 | + needs: integration-test |
| 102 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 103 | + |
| 104 | + strategy: |
| 105 | + matrix: |
| 106 | + java_version: ['8'] |
| 107 | + |
| 108 | + steps: |
| 109 | + - uses: actions/checkout@v1 |
| 110 | + - name: Set up JDK ${{ matrix.java_version }} |
| 111 | + uses: actions/setup-java@v1 |
| 112 | + with: |
| 113 | + java-version: ${{ matrix.java_version }} |
| 114 | + - name: Deploy snapshot with maven |
| 115 | + run: mvn clean deploy --settings=./.buildscript/settings.xml |
| 116 | + |
0 commit comments