source: josm/trunk/.github/workflows/ant.yml@ 17236

Last change on this file since 17236 was 17236, checked in by Don-vip, 4 years ago

see #19937 - Update macOS build process (patch by Stereo, modified)

See See https://github.com/openstreetmap/josm/pull/65

File size: 5.9 KB
Line 
1name: Java CI
2env:
3 junit_platform_version: '1.7.0'
4 # ANT_HOME is also our ant version
5 ANT_HOME: 'apache-ant-1.10.9'
6on:
7 push:
8 branches: [master]
9 pull_request:
10 branches: [master]
11
12defaults:
13 run:
14 shell: bash
15
16jobs:
17 build:
18 runs-on: ${{ matrix.os }}
19 env:
20 LANG: en_US.UTF-8
21 strategy:
22 fail-fast: false
23 matrix:
24 # test against latest update of each major Java version, as well as specific updates of LTS versions:
25 java: [8, 11, 14, 15, 16-ea]
26 os: [ubuntu-latest, macos-latest, windows-latest]
27 headless: ["true", "false"]
28 exclude:
29 - java: 8
30 os: macos-latest
31 - java: 11
32 os: macos-latest
33 - headless: "false"
34 os: macos-latest
35 - headless: "false"
36 os: windows-latest
37 name: Java ${{ matrix.java }} on ${{ matrix.os }} with headless=${{ matrix.headless }}
38 steps:
39 - name: Checkout
40 uses: actions/checkout@v2
41 with:
42 fetch-depth: 128
43 - name: Cache
44 uses: actions/cache@v2.0.0
45 with:
46 path: |
47 ~/.ivy2/cache/
48 ~/work/josm/josm/tools/
49 key: ${{ runner.os }}-ivy2-${{ hashFiles('ivy.xml') }}
50 - name: Setup java
51 uses: actions/setup-java@v1.4.3
52 with:
53 java-version: ${{ matrix.java }}
54 - name: Install ant ${{ env.ANT_HOME }} and junit ${{ env.junit_platform_version }}
55 # Todo: cache ant and junit, saves 12 seconds.
56 run: |
57 curl -s https://downloads.apache.org/ant/binaries/${{ env.ANT_HOME }}-bin.tar.gz | tar -xz
58 curl -o ${{ env.ANT_HOME }}/lib/junit-platform-console-standalone-${{ env.junit_platform_version }}.jar "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/${{ env.junit_platform_version }}/junit-platform-console-standalone-${{ env.junit_platform_version }}.jar"
59 - name: Print ant version, expecting ${{ env.ANT_HOME }}
60 run: ${{ env.ANT_HOME }}/bin/ant -version
61 - name: Set revision env variable
62 run: |
63 ant create-revision
64 josm_revision=`awk '/Revision/{print $2}' resources/REVISION`
65 if [[ "$josm_revision" == `curl --silent https://josm.openstreetmap.de/tested` ]]; then
66 sed -i .bak '/Is-Local-Build/d' resources/REVISION
67 echo "josm_prerelease=false" >> $GITHUB_ENV
68 else
69 echo "josm_prerelease=true" >> $GITHUB_ENV
70 fi
71 echo "josm_revision=$josm_revision" >> $GITHUB_ENV
72 - name: Build with Ant, headless ${{ matrix.headless }}
73 run: |
74 ANT="${{ env.ANT_HOME }}/bin/ant -DnoJavaFX=true test-unit-hardfail"
75 if [ "${{ matrix.headless }}" == "true" ]; then
76 $ANT -Dtest.headless=true
77 else
78 xvfb-run $ANT -Dtest.headless=false
79 fi
80 - name: Dump errors if failed
81 if: ${{ failure() }}
82 run: "grep -L ', Failures: 0, Skipped: ' test/report/*.txt | xargs cat"
83 - name: Upload Ant reports
84 if: ${{ always() }}
85 uses: actions/upload-artifact@v2
86 with:
87 name: Ant reports for JOSM ${{ env.josm_revision }} on java ${{ matrix.java }} on ${{ matrix.os }} with headless=${{ matrix.headless }}
88 path: test/report/*.txt
89 - name: Optimise images
90 if: ${{ runner.os == 'macos' && always() }}
91 run: |
92 brew cask install imageoptim
93 defaults write net.pornel.ImageOptim SvgoEnabled 1
94 defaults write net.pornel.ImageOptim PngCrush2Enabled 1
95 defaults write net.pornel.ImageOptim PngOutEnabled 1
96 /Applications/ImageOptim.app/Contents/MacOS/ImageOptim resources/images
97 - name: Build and package for macOS
98 if: ${{ runner.os == 'macos' && always() }}
99 env:
100 CERT_MACOS_P12: ${{ secrets.CERT_MACOS_P12 }}
101 CERT_MACOS_PW: ${{ secrets.CERT_MACOS_PW }}
102 APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }}
103 run: |
104 $ANT_HOME/bin/ant dist
105 ./native/macosx/macos-jpackage.sh ${{ env.josm_revision }}
106 - name: Create macOS release
107 if: ${{ runner.os == 'macos' && always() }}
108 id: create_release
109 uses: actions/create-release@v1
110 env:
111 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
112 with:
113 tag_name: ${{ env.josm_revision }}
114 release_name: JOSM.app release ${{ env.josm_revision }}
115 body: |
116 JOSM.app release ${{ env.josm_revision }}
117 draft: false
118 prerelease: ${{ env.josm_prerelease }}
119 - name: Upload app
120 if: ${{ runner.os == 'macos' && always() }}
121 id: upload-app
122 uses: actions/upload-release-asset@v1
123 env:
124 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125 with:
126 upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
127 asset_path: dist/JOSM.zip
128 asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}.zip
129 asset_content_type: application/zip
130 - name: Upload jar
131 if: ${{ runner.os == 'macos' && always() }}
132 id: upload-jar
133 uses: actions/upload-release-asset@v1
134 env:
135 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136 with:
137 upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
138 asset_path: dist/josm-custom.jar
139 asset_name: josm-latest.jar
140 asset_content_type: application/java-archive
Note: See TracBrowser for help on using the repository browser.