Skip to content

Commit

Permalink
Use standardized GitHub workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Jul 30, 2024
1 parent 9c610a1 commit e3f000b
Showing 1 changed file with 40 additions and 63 deletions.
103 changes: 40 additions & 63 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,48 @@ name: Java CI

on:
push:
branches: [ main, fixup-tests ]
branches:
- main
- $default-branch
- $protected-branches
pull_request:
branches: [ main ]
release:
types: [created]
branches:
- main
- $default-branch
workflow_dispatch:

jobs:
build:
check-release-needed:
runs-on: ubuntu-latest
outputs:
release_needed: ${{ steps.create_release_needed.outputs.release_needed }}
steps:
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Cache
uses: actions/[email protected]
with:
path: |
~/.ivy2/cache/
$GITHUB_WORKSPACE/josm/core/tools/
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') }}
- name: Clone JOSM
run: |
svn co --depth=immediates https://josm.openstreetmap.de/osmsvn/applications/editors/josm $GITHUB_WORKSPACE/josm
cd $GITHUB_WORKSPACE/josm
svn up --set-depth=immediates plugins
svn up --set-depth=infinity --accept=theirs-full core i18n plugins/{00_core_test_config,00_core_test_lib,00_core_tools,00_tools}
svn propget svn:externals | grep core | xargs -L1 svn co
cd core
ant dist
cd ../plugins
svn propget svn:externals | grep 00_core | xargs -L1 svn co
- uses: actions/checkout@v3
with:
path: josm/plugins/${{ github.event.repository.name }}
- name: Build with Ant
run: |
cd $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}
if [ $GITHUB_REF_TYPE == "tag" ]; then
version=$GITHUB_REF_NAME
else
version="$GITHUB_REF_NAME-$GITHUB_SHA"
fi
ant -noinput -buildfile build.xml -Dplugin.version=$version
- name: Test with Ant
run: |
cd $GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}
ant -noinput -buildfile build.xml -Dplugin.version=$version -Dtest.headless test
- name: Dump errors if failed
if: ${{ failure() }}
run: "grep -L ', Failures: 0, Skipped: ' test/report/*.txt | xargs cat"
- name: Upload Ant reports
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: Ant reports for JOSM plugin ${{ github.event.repository.name }}
path: |
$GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}/test/report/*.txt
$GITHUB_WORKSPACE/josm/plugins/${{ github.event.repository.name }}/test/report/TEST*.xml
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
josm/dist/${{ github.event.repository.name }}.jar
josm/dist/${{ github.event.repository.name }}-javadoc.jar
josm/dist/${{ github.event.repository.name }}-sources.jar
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: ${{ (github.repository == 'JOSM/wikipedia' && github.ref_type == 'branch' && github.ref_name == 'main' && github.event_name != 'schedule' && github.event_name != 'pull_request') && '0' || '1' }}

- name: Set release needed
id: create_release_needed
run: |
last_tag=$(git describe --tags --abbrev=0 --always)
release_needed="false"
for file in $(git diff ${last_tag}..HEAD --name-only); do
if [[ $file = "src/main"* ]] || [[ $file = "" ]]; then
release_needed="true"
break
fi
done
echo "release_needed=$release_needed" >> $GITHUB_OUTPUT
call-workflow:
needs: check-release-needed
strategy:
matrix:
josm-revision: ["", "r18877"]
uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v2
with:
josm-revision: ${{ matrix.josm-revision }}
perform-revision-tagging: ${{ matrix.josm-revision == 'r18877' && needs.check-release-needed.outputs.release_needed == 'true' }}
secrets: inherit

0 comments on commit e3f000b

Please sign in to comment.