From a89044fd942a876406b1206797e84e7d9f8a2888 Mon Sep 17 00:00:00 2001 From: extrawurst <776816+extrawurst@users.noreply.github.com> Date: Sun, 2 Jun 2024 13:54:32 +0200 Subject: [PATCH] Build apple x86 (#2253) --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/nightly.yml | 14 +++++++++----- Makefile | 14 ++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 453c8a79..b15568ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,9 @@ jobs: toolchain: ${{ matrix.rust }} components: clippy + - name: Rustup Show + run: rustup show + - name: Build Debug run: | cargo build @@ -171,6 +174,38 @@ jobs: make build-linux-arm-release ls -l ./target/aarch64-unknown-linux-gnu/release/gitui || ls -l ./target/armv7-unknown-linux-gnueabihf/release/gitui || ls -l ./target/arm-unknown-linux-gnueabihf/release/gitui + build-apple-x86: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + rust: [nightly, stable, '1.70'] + continue-on-error: ${{ matrix.rust == 'nightly' }} + steps: + - uses: actions/checkout@v4 + + - name: Restore cargo cache + uses: Swatinem/rust-cache@v2 + env: + cache-name: ci + with: + key: apple-x86-${{ env.cache-name }}-${{ matrix.rust }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + - name: Setup target + run: rustup target add x86_64-apple-darwin + + - name: Build Debug + run: | + make build-apple-x86-debug + - name: Build Release + run: | + make build-apple-x86-release + ls -l ./target/x86_64-apple-darwin/release/gitui + linting: name: Lints runs-on: ubuntu-latest diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ab4cd463..bb1299b8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,6 +1,6 @@ name: Build Nightly Releases -on: +on: schedule: - cron: '0 3 * * *' workflow_dispatch: @@ -34,7 +34,7 @@ jobs: with: components: clippy - # ideally we trigger the nightly build/deploy only if the normal nightly CI finished successfully + # ideally we trigger the nightly build/deploy only if the normal nightly CI finished successfully - name: Run tests if: matrix.os != 'ubuntu-22.04' run: make test @@ -69,6 +69,9 @@ jobs: - name: Build Release Mac if: matrix.os == 'macos-latest' run: make release-mac + - name: Build Release Mac x86 + if: matrix.os == 'macos-latest' + run: make release-mac-x68 - name: Build Release Linux if: matrix.os == 'ubuntu-latest' run: make release-linux-musl @@ -89,7 +92,7 @@ jobs: aws s3 cp ./release/gitui-linux-armv7.tar.gz $AWS_BUCKET_NAME aws s3 cp ./release/gitui-linux-arm.tar.gz $AWS_BUCKET_NAME aws s3 cp ./release/gitui-linux-aarch64.tar.gz $AWS_BUCKET_NAME - + - name: Ubuntu Latest Upload Artifact if: matrix.os == 'ubuntu-latest' env: @@ -100,16 +103,17 @@ jobs: aws s3 cp ./release/gitui-linux-x86_64.tar.gz $AWS_BUCKET_NAME - name: MacOS Upload Artifact - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos-latest' env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_KEY_SECRET }} AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} run: | aws s3 cp ./release/gitui-mac.tar.gz $AWS_BUCKET_NAME + aws s3 cp ./release/gitui-mac-x86.tar.gz $AWS_BUCKET_NAME - name: Windows Upload Artifact - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-latest' env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_KEY_SECRET }} diff --git a/Makefile b/Makefile index f58cbb04..deb93838 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,14 @@ release-mac: build-release tar -C ./target/release/ -czvf ./release/gitui-mac.tar.gz ./gitui ls -lisah ./release/gitui-mac.tar.gz +release-mac-x86: build-apple-x86-release + strip target/x86_64-apple-darwin/release/gitui + otool -L target/x86_64-apple-darwin/release/gitui + ls -lisah target/x86_64-apple-darwin/release/gitui + mkdir -p release + tar -C ./target/x86_64-apple-darwin/release/ -czvf ./release/gitui-mac-x86.tar.gz ./gitui + ls -lisah ./release/gitui-mac-x86.tar.gz + release-win: build-release mkdir -p release tar -C ./target/release/ -czvf ./release/gitui-win.tar.gz ./gitui.exe @@ -38,6 +46,12 @@ release-linux-musl: build-linux-musl-release mkdir -p release tar -C ./target/x86_64-unknown-linux-musl/release/ -czvf ./release/gitui-linux-x86_64.tar.gz ./gitui +build-apple-x86-debug: + cargo build --target=x86_64-apple-darwin + +build-apple-x86-release: + cargo build --release --target=x86_64-apple-darwin + build-linux-musl-debug: cargo build --target=x86_64-unknown-linux-musl