|
| 1 | +name: Java CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, fixup-tests ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + release: |
| 9 | + types: [created] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Set up JDK 8 |
| 16 | + uses: actions/setup-java@v3 |
| 17 | + with: |
| 18 | + java-version: '8' |
| 19 | + distribution: 'temurin' |
| 20 | + - name: Cache |
| 21 | + |
| 22 | + with: |
| 23 | + path: | |
| 24 | + ~/.ivy2/cache/ |
| 25 | + $GITHUB_WORKSPACE/josm/core/tools/ |
| 26 | + key: ${{ runner.os }}-ivy2-${{ hashFiles('josm/plugins/${{ github.event.repository.name }}/build.xml', 'josm/plugins/00_core_tools/ivy.xml', 'josm/core/ivy.xml', 'josm/core/tools/ivy.xml') }} |
| 27 | + - name: Clone JOSM |
| 28 | + run: | |
| 29 | + svn co --depth=immediates https://josm.openstreetmap.de/osmsvn/applications/editors/josm $GITHUB_WORKSPACE/josm |
| 30 | + cd $GITHUB_WORKSPACE/josm |
| 31 | + svn up --set-depth=immediates plugins |
| 32 | + svn up --set-depth=infinity --accept=theirs-full core i18n plugins/{00_core_test_config,00_core_test_lib,00_core_tools,00_tools} |
| 33 | + svn propget svn:externals | grep core | xargs -L1 svn co |
| 34 | + cd core |
| 35 | + ant dist |
| 36 | + cd ../plugins |
| 37 | + svn propget svn:externals | grep 00_core | xargs -L1 svn co |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + with: |
| 40 | + path: josm/plugins/${{ github.event.repository.name }} |
| 41 | + - name: Build with Ant |
| 42 | + run: | |
| 43 | + cd $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }} |
| 44 | + if [ $GITHUB_REF_TYPE == "tag" ]; then |
| 45 | + version=$GITHUB_REF_NAME |
| 46 | + else |
| 47 | + version="$GITHUB_REF_NAME-$GITHUB_SHA" |
| 48 | + fi |
| 49 | + ant -noinput -buildfile build.xml -Dplugin.version=$version |
| 50 | + - name: Test with Ant |
| 51 | + run: | |
| 52 | + cd $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }} |
| 53 | + ant -noinput -buildfile build.xml -Dplugin.version=$version -Dtest.headless test |
| 54 | + - name: Dump errors if failed |
| 55 | + if: ${{ failure() }} |
| 56 | + run: "grep -L ', Failures: 0, Skipped: ' test/report/*.txt | xargs cat" |
| 57 | + - name: Upload Ant reports |
| 58 | + if: ${{ always() }} |
| 59 | + uses: actions/upload-artifact@v2 |
| 60 | + with: |
| 61 | + name: Ant reports for JOSM plugin ${{ github.event.repository.name }} |
| 62 | + path: | |
| 63 | + $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}/test/report/*.txt |
| 64 | + $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}/test/report/TEST*.xml |
| 65 | + - name: Release |
| 66 | + uses: softprops/action-gh-release@v1 |
| 67 | + if: startsWith(github.ref, 'refs/tags/') |
| 68 | + with: |
| 69 | + files: | |
| 70 | + josm/dist/${{ github.event.repository.name }}.jar |
| 71 | + josm/dist/${{ github.event.repository.name }}-javadoc.jar |
| 72 | + josm/dist/${{ github.event.repository.name }}-sources.jar |
0 commit comments