From 95aec2748e0622ac079920e449dcc8b2ee29dbd8 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Sun, 18 Feb 2024 15:19:12 -0500 Subject: [PATCH] ci(release): add distribution for ARM macs (#1625) * add macos-14 (m1 runner) build to release matrix * native support for apple silicon, removes need for rosetta * use devtools os tags to distinguish intel from arm mac artifacts * remove unused inputs from release_dispatch.yml: commit_version, reset --- .github/workflows/release.yml | 54 ++++++++++++++++---------- .github/workflows/release_dispatch.yml | 12 +----- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21cf847db20..689c93d8dd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,11 +63,9 @@ jobs: matrix: include: - os: ${{ inputs.linux_version }} - ostag: linux - os: macos-12 - ostag: mac + - os: macos-14 - os: windows-2022 - ostag: win64 defaults: run: shell: bash -l {0} @@ -141,10 +139,16 @@ jobs: meson install -C builddir meson test --verbose --no-rebuild -C builddir + - name: Get OS tag + id: ostag + run: | + ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())") + echo "ostag=$ostag" >> $GITHUB_OUTPUT + - name: Upload binaries uses: actions/upload-artifact@v3 with: - name: bin-${{ runner.os }} + name: bin-${{ steps.ostag.outputs.ostag }} path: modflow6/bin # only run steps below if inputs.run_tests is true @@ -309,10 +313,16 @@ jobs: working-directory: modflow6/autotest run: python update_flopy.py + - name: Get OS tag + id: ostag + run: | + ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())") + echo "ostag=$ostag" >> $GITHUB_OUTPUT + - name: Download pre-built binaries uses: actions/download-artifact@v3 with: - name: bin-${{ runner.os }} + name: bin-${{ steps.ostag.outputs.ostag }} path: bin # execute permissions may not have survived artifact upload/download @@ -402,11 +412,9 @@ jobs: matrix: include: - os: ubuntu-22.04 - ostag: linux - os: macos-12 - ostag: mac + - os: macos-14 - os: windows-2022 - ostag: win64 defaults: run: shell: bash -l {0} @@ -453,22 +461,28 @@ jobs: cmd="$cmd --releasemode" fi eval "$cmd" + + - name: Get OS tag + id: ostag + run: | + ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())") + echo "ostag=$ostag" >> $GITHUB_OUTPUT - name: Download artifacts uses: actions/download-artifact@v3 with: - path: ${{ needs.build.outputs.distname }}_${{ matrix.ostag }} + path: ${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }} - name: Select artifacts - working-directory: ${{ needs.build.outputs.distname }}_${{ matrix.ostag }} + working-directory: ${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }} run: | - echo "selecting ${{ matrix.ostag }} artifacts" + echo "selecting ${{ steps.ostag.outputs.ostag }} artifacts" # remove dists for other systems rm -rf ${{ needs.build.outputs.distname }}_* # remove release notes rm -rf release_notes # rename dist bin directory - mv bin-${{ runner.os }} bin + mv bin-${{ steps.ostag.outputs.ostag }} bin # remove binaries for other systems rm -rf bin-* @@ -480,7 +494,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: | pip install -r modflow6-examples/etc/requirements.pip.txt - distname="${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" + distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" echo "$distname/bin" >> $GITHUB_PATH # execute permissions may not have survived artifact upload/download chmod +x "$distname/bin/mf6" @@ -507,7 +521,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: | # build distribution - distname="${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" + distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" cmd="python modflow6/distribution/build_dist.py -o $distname -e modflow6-examples" if [[ "${{ inputs.full }}" == "true" ]]; then cmd="$cmd --full" @@ -522,7 +536,7 @@ jobs: - name: Zip distribution if: runner.os != 'Windows' run: | - distname="${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" + distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" if [[ "${{ inputs.full }}" == "true" ]]; then zip -r $distname.zip \ $distname/bin \ @@ -557,7 +571,7 @@ jobs: - name: Zip distribution (Windows) if: runner.os == 'Windows' run: | - distname="${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" + distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" if [[ "${{ inputs.full }}" == "true" ]]; then 7z a -tzip $distname.zip \ $distname/bin \ @@ -590,20 +604,20 @@ jobs: - name: Upload distribution uses: actions/upload-artifact@v3 with: - name: "${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" - path: "${{ needs.build.outputs.distname }}_${{ matrix.ostag }}.zip" + name: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" + path: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}.zip" - name: Upload release notes if: runner.os == 'Linux' uses: actions/upload-artifact@v3 with: name: release_notes - path: "${{ needs.build.outputs.distname }}_${{ matrix.ostag }}/doc/release.pdf" + path: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}/doc/release.pdf" - name: Check distribution run: | # unzip and validate the archive - distname="${{ needs.build.outputs.distname }}_${{ matrix.ostag }}" + distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}" distfile="$distname.zip" checkdir="check" mkdir $checkdir diff --git a/.github/workflows/release_dispatch.yml b/.github/workflows/release_dispatch.yml index 2f1f04ff9dc..654d6acd292 100644 --- a/.github/workflows/release_dispatch.yml +++ b/.github/workflows/release_dispatch.yml @@ -34,16 +34,6 @@ on: required: false type: string default: '2021.7' - commit_version: - description: 'Commit version numbers back to the develop branch. Not considered if reset is false.' - required: false - type: boolean - default: false - reset: - description: 'Reset the develop branch from the master branch. Not considered if approve is false.' - required: false - type: boolean - default: false run_tests: description: 'Run tests after building binaries.' required: false @@ -129,8 +119,8 @@ jobs: echo "version=$ver" >> $GITHUB_OUTPUT make_dist: name: Make distribution - needs: set_options uses: MODFLOW-USGS/modflow6/.github/workflows/release.yml@develop + needs: set_options with: # If the workflow is manually triggered, the maintainer must manually set approve=true to approve a release. # If triggered by pushing a release branch, the release is approved if the branch name doesn't contain "rc".