Changeset 17236 in josm for trunk/.github/workflows


Ignore:
Timestamp:
2020-10-18T15:34:35+02:00 (4 years ago)
Author:
Don-vip
Message:

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/ant.yml

    r17156 r17236  
    11name: Java CI
    22env:
     3  junit_platform_version: '1.7.0'
    34  # ANT_HOME is also our ant version
    4   ANT_HOME: "apache-ant-1.10.8"
     5  ANT_HOME: 'apache-ant-1.10.9'
    56on:
    67  push:
     
    2223      matrix:
    2324        # test against latest update of each major Java version, as well as specific updates of LTS versions:
    24         java: [8, 11, 14]
     25        java: [8, 11, 14, 15, 16-ea]
    2526        os: [ubuntu-latest, macos-latest, windows-latest]
    2627        headless: ["true", "false"]
     
    3940        uses: actions/checkout@v2
    4041        with:
    41           fetch-depth: 64
     42          fetch-depth: 128
    4243      - name: Cache
    4344        uses: actions/cache@v2.0.0
    4445        with:
    45           path: |
     46          path:  |
    4647            ~/.ivy2/cache/
    4748            ~/work/josm/josm/tools/
    4849          key: ${{ runner.os }}-ivy2-${{ hashFiles('ivy.xml') }}
    4950      - name: Setup java
    50         uses: actions/setup-java@v1.3.0
     51        uses: actions/setup-java@v1.4.3
    5152        with:
    5253          java-version: ${{ matrix.java }}
    53       - name: Install ant ${{ env.ANT_HOME }}
     54      - name: Install ant ${{ env.ANT_HOME }} and junit ${{ env.junit_platform_version }}
     55        # Todo: cache ant and junit, saves 12 seconds.
    5456        run: |
    55           curl -s https://archive.apache.org/dist/ant/binaries/${{ env.ANT_HOME }}-bin.tar.gz | tar -xz
     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"
    5659      - name: Print ant version, expecting ${{ env.ANT_HOME }}
    57         run: ${{ env.ANT_HOME }}/bin/ant -diagnostics
     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
    5872      - name: Build with Ant, headless ${{ matrix.headless }}
    5973        run: |
     
    6781        if: ${{ failure() }}
    6882        run: "grep -L ', Failures: 0, Skipped: ' test/report/*.txt | xargs cat"
    69       - name: Set revision env variable
    70         if: ${{ always() }}
    71         # Careful, you will only have a resources/REVISION if you've already built
    72         run: echo "::set-env name=josm_revision::`awk '/Revision/{print $2}' resources/REVISION`"
    7383      - name: Upload Ant reports
    7484        if: ${{ always() }}
     
    7787          name: Ant reports for JOSM ${{ env.josm_revision }} on java ${{ matrix.java }} on ${{ matrix.os }} with headless=${{ matrix.headless }}
    7888          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
    7997      - name: Build and package for macOS
    8098        if: ${{ runner.os == 'macos' && always() }}
     
    86104          $ANT_HOME/bin/ant dist
    87105          ./native/macosx/macos-jpackage.sh ${{ env.josm_revision }}
    88       - name: Upload JOSM.app for macOS
     106      - name: Create macOS release
    89107        if: ${{ runner.os == 'macos' && always() }}
    90         uses: actions/upload-artifact@v2
     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
    91112        with:
    92           name: JOSM.app revision ${{ env.josm_revision }}
    93           path: dist/JOSM.zip
     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 TracChangeset for help on using the changeset viewer.