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