| 1 |
name: Java CI Test |
| 2 |
env: |
| 3 |
junit_platform_version: '1.9.3' |
| 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 |
|
| 22 |
java: [11, 21, 25] |
| 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@v6 |
| 28 |
with: |
| 29 |
fetch-depth: 256 |
| 30 |
|
| 31 |
- name: Cache |
| 32 |
uses: actions/cache@v5 |
| 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@v5 |
| 41 |
with: |
| 42 |
distribution: 'zulu' |
| 43 |
java-version: ${{ matrix.java }} |
| 44 |
|
| 45 |
- name: Install Ant |
| 46 |
uses: JOSM/JOSMPluginAction/actions/setup-ant@v3 |
| 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@v7 |
| 60 |
with: |
| 61 |
name: Ant reports for JOSM on java ${{ matrix.java }} on ${{ matrix.os }} |
| 62 |
path: | |
| 63 |
test/report/*.txt |
| 64 |
test/report/TEST*.xml |
| 65 |
hs_err* |
| 66 |
|
| 67 |
publish-test-results: |
| 68 |
name: "Publish Unit Tests Results" |
| 69 |
needs: test |
| 70 |
runs-on: ubuntu-latest |
| 71 |
|
| 72 |
if: success() || failure() |
| 73 |
|
| 74 |
steps: |
| 75 |
- name: Download Artifacts |
| 76 |
uses: actions/download-artifact@v8 |
| 77 |
with: |
| 78 |
path: artifacts |
| 79 |
|
| 80 |
- name: Publish Test Report with action-junit-report |
| 81 |
if: ${{ always() }} |
| 82 |
uses: mikepenz/action-junit-report@v6 |
| 83 |
with: |
| 84 |
report_paths: 'artifacts/**/*.xml' |
| 85 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 86 |
|
| 87 |
- name: Publish Test Report with publish-unit-test-result-action |
| 88 |
uses: EnricoMi/publish-unit-test-result-action@v2 |
| 89 |
with: |
| 90 |
files: 'artifacts/**/*.xml' |