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, 16, 17-ea, 18-ea]
|
---|
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/
|
---|
44 | key: ${{ runner.os }}-ivy2-${{ hashFiles('build.xml', 'ivy.xml', 'tools/ivy.xml') }}
|
---|
45 |
|
---|
46 | - name: Setup Java ${{ matrix.java }}
|
---|
47 | uses: actions/setup-java@v2
|
---|
48 | with:
|
---|
49 | distribution: 'zulu'
|
---|
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 }}
|
---|
76 | path: |
|
---|
77 | test/report/*.txt
|
---|
78 | test/report/TEST*.xml
|
---|
79 |
|
---|
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 |
|
---|
93 | - name: Publish Test Report with action-junit-report
|
---|
94 | if: ${{ always() }}
|
---|
95 | uses: mikepenz/action-junit-report@v2
|
---|
96 | with:
|
---|
97 | report_paths: 'artifacts/**/*.xml'
|
---|
98 | token: ${{ secrets.GITHUB_TOKEN }}
|
---|
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'
|
---|