[17694] | 1 | name: Java CI Test
|
---|
| 2 | env:
|
---|
[17970] | 3 | junit_platform_version: '1.7.2'
|
---|
[17694] | 4 | # ANT_HOME is also our ant version
|
---|
[18020] | 5 | ANT_HOME: 'apache-ant-1.10.11'
|
---|
[17694] | 6 | on:
|
---|
| 7 | - push
|
---|
| 8 | - pull_request
|
---|
| 9 |
|
---|
| 10 | defaults:
|
---|
| 11 | run:
|
---|
| 12 | shell: bash
|
---|
| 13 |
|
---|
| 14 | jobs:
|
---|
| 15 |
|
---|
| 16 | test:
|
---|
| 17 | runs-on: ${{ matrix.os }}
|
---|
| 18 | env:
|
---|
| 19 | LANG: en_US.UTF-8
|
---|
| 20 | strategy:
|
---|
| 21 | fail-fast: false
|
---|
| 22 | matrix:
|
---|
| 23 | # test against latest update of each major Java version, as well as specific updates of LTS versions:
|
---|
[17970] | 24 | java: [8, 11, 16, 17-ea, 18-ea]
|
---|
[17694] | 25 | os: [ubuntu-latest, macos-latest, windows-latest]
|
---|
| 26 | exclude:
|
---|
| 27 | - java: 8
|
---|
| 28 | os: macos-latest
|
---|
| 29 | - java: 11
|
---|
| 30 | os: macos-latest
|
---|
| 31 | name: Java ${{ matrix.java }} on ${{ matrix.os }}
|
---|
| 32 | steps:
|
---|
| 33 | - name: Checkout
|
---|
| 34 | uses: actions/checkout@v2
|
---|
| 35 | with:
|
---|
| 36 | fetch-depth: 256
|
---|
| 37 |
|
---|
| 38 | - name: Cache
|
---|
| 39 | uses: actions/cache@v2.0.0
|
---|
| 40 | with:
|
---|
| 41 | path: |
|
---|
| 42 | ~/.ivy2/cache/
|
---|
| 43 | ~/work/josm/josm/tools/
|
---|
[17918] | 44 | key: ${{ runner.os }}-ivy2-${{ hashFiles('build.xml', 'ivy.xml', 'tools/ivy.xml') }}
|
---|
[17694] | 45 |
|
---|
| 46 | - name: Setup Java ${{ matrix.java }}
|
---|
[17970] | 47 | uses: actions/setup-java@v2
|
---|
[17694] | 48 | with:
|
---|
[17970] | 49 | distribution: 'zulu'
|
---|
[17694] | 50 | java-version: ${{ matrix.java }}
|
---|
| 51 |
|
---|
| 52 | - name: Install Ant ${{ env.ANT_HOME }}
|
---|
| 53 | run: |
|
---|
| 54 | if [ ! -f tools/${{ env.ANT_HOME }}-bin.tar.gz ]; then
|
---|
| 55 | curl -o tools/${{ env.ANT_HOME }}-bin.tar.gz https://downloads.apache.org/ant/binaries/${{ env.ANT_HOME }}-bin.tar.gz
|
---|
| 56 | fi
|
---|
| 57 | tar zxf tools/${{ env.ANT_HOME }}-bin.tar.gz
|
---|
| 58 |
|
---|
| 59 | - name: Ant diagnostics
|
---|
| 60 | run: ${{ env.ANT_HOME }}/bin/ant -diagnostics
|
---|
| 61 |
|
---|
| 62 | - name: Test with Ant
|
---|
| 63 | run: |
|
---|
| 64 | ANT="${{ env.ANT_HOME }}/bin/ant -DnoJavaFX=true test-unit-hardfail"
|
---|
| 65 | $ANT -Dtest.headless=true
|
---|
| 66 |
|
---|
| 67 | - name: Dump errors if failed
|
---|
| 68 | if: ${{ failure() }}
|
---|
| 69 | run: "grep -L ', Failures: 0, Skipped: ' test/report/*.txt | xargs cat"
|
---|
| 70 |
|
---|
| 71 | - name: Upload Ant reports
|
---|
| 72 | if: ${{ always() }}
|
---|
| 73 | uses: actions/upload-artifact@v2
|
---|
| 74 | with:
|
---|
| 75 | name: Ant reports for JOSM ${{ needs.createrelease.outputs.josm_revision }} on java ${{ matrix.java }} on ${{ matrix.os }}
|
---|
[18026] | 76 | path: |
|
---|
| 77 | test/report/*.txt
|
---|
| 78 | test/report/TEST*.xml
|
---|
[17694] | 79 |
|
---|
[18026] | 80 | publish-test-results:
|
---|
| 81 | name: "Publish Unit Tests Results"
|
---|
| 82 | needs: test
|
---|
| 83 | runs-on: ubuntu-latest
|
---|
| 84 | # the test job might be skipped, we don't need to run this job then
|
---|
| 85 | if: success() || failure()
|
---|
| 86 |
|
---|
| 87 | steps:
|
---|
| 88 | - name: Download Artifacts
|
---|
| 89 | uses: actions/download-artifact@v2
|
---|
| 90 | with:
|
---|
| 91 | path: artifacts
|
---|
| 92 |
|
---|
[17694] | 93 | - name: Publish Test Report with action-junit-report
|
---|
| 94 | if: ${{ always() }}
|
---|
[17970] | 95 | uses: mikepenz/action-junit-report@v2
|
---|
[17694] | 96 | with:
|
---|
[18026] | 97 | report_paths: 'artifacts/**/*.xml'
|
---|
[17970] | 98 | token: ${{ secrets.GITHUB_TOKEN }}
|
---|
[18026] | 99 |
|
---|
| 100 | - name: Publish Test Report with publish-unit-test-result-action
|
---|
| 101 | uses: EnricoMi/publish-unit-test-result-action@v1
|
---|
| 102 | with:
|
---|
| 103 | files: 'artifacts/**/*.xml'
|
---|