From ab67c149ad98f67859d885e220e7fe84b2897142 Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Wed, 3 Jul 2024 11:36:44 +0200 Subject: [PATCH] Try build macos arm --- .github/workflows/ci.yml | 4 +++ .github/workflows/publish.yml | 58 +++++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1df8f9a..4e720ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: branches: - main +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check: name: check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4ca8033..de95fd6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,8 +5,13 @@ on: - 'v*' branches: - main + +concurrency: + group: publish-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: - build: + publish-linux: runs-on: ubuntu-latest strategy: fail-fast: true @@ -143,9 +148,24 @@ jobs: replacesArtifacts: true artifacts: ${{ steps.strip.outputs.BIN_PATH }} - build-win: - runs-on: windows-latest + publish-mac: + runs-on: macos-latest + strategy: + fail-fast: true + matrix: + build: + - aarch64 + - amd64 + include: + - build: amd64 + target: x86_64-apple-darwin + use-cross: true + features: "" + - build: aarch64 + target: aarch64-apple-darwin + use-cross: false + features: "" steps: - name: Checkout uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 @@ -156,6 +176,7 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable + target: ${{ matrix.target }} override: true default: true @@ -171,15 +192,22 @@ jobs: echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV fi + - name: Add build env parameters + shell: bash + run: | + echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV + echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun --show-sdk-platform-version)" >> $GITHUB_ENV + - name: Build uses: actions-rs/cargo@v1 with: + use-cross: ${{ matrix.use-cross }} command: build - args: ${{ matrix.features }} --release + args: ${{ matrix.features }} --release --target=${{ matrix.target }} - name: Rename binary run: | - mv target/release/${{ env.PROJECT_NAME }}.exe target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe + mv target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }} - name: Publish Release id: publish @@ -188,8 +216,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + prerelease: ${{ github.ref }} == "refs/heads/main" files: | - target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe + target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }} - name: Publish Pre-Release id: publish-pre @@ -205,10 +234,10 @@ jobs: commit: "main" name: "renku-cli nightly" replacesArtifacts: true - artifacts: target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe + artifacts: target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }} - build-mac: - runs-on: macos-latest + publish-win: + runs-on: windows-latest steps: - name: Checkout @@ -220,7 +249,6 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable - target: x86_64-apple-darwin override: true default: true @@ -242,10 +270,9 @@ jobs: command: build args: ${{ matrix.features }} --release - - name: Rename and strip binary + - name: Rename binary run: | - strip target/release/${{ env.PROJECT_NAME }} - mv target/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} + mv target/release/${{ env.PROJECT_NAME }}.exe target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe - name: Publish Release id: publish @@ -254,9 +281,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - prerelease: ${{ github.ref }} == "refs/heads/main" files: | - target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} + target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe - name: Publish Pre-Release id: publish-pre @@ -272,4 +298,4 @@ jobs: commit: "main" name: "renku-cli nightly" replacesArtifacts: true - artifacts: target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} + artifacts: target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe