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