From eb6316e8060a26f3acc5334fd20308a31e0d207f Mon Sep 17 00:00:00 2001 From: Cynthia Coan Date: Thu, 4 Apr 2024 18:30:39 -0600 Subject: [PATCH] start building for ARM for mac osx (#9) --- .github/workflows/package.yml | 59 +++++++++++++++++++++++-------- .github/workflows/validate-pr.yml | 6 ++-- .gitignore | 1 + installer-scripts/osx/package.sh | 19 ++++++++++ 4 files changed, 68 insertions(+), 17 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 26c0de3..69f66d7 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -26,11 +26,11 @@ jobs: wix build sprig.wxs -ext WiXToolset.Util.wixext -ext WiXToolset.UI.wixext -defaultcompressionlevel high -arch "x64" -bindpath "../../" - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.msi + name: sprig_win_amd64.msi path: installer-scripts/win/sprig.msi - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.wixpdb + name: sprig_win_amd64.wixpdb path: installer-scripts/win/sprig.wixpdb - uses: actions/upload-artifact@v3 with: @@ -42,9 +42,9 @@ jobs: !target/release/deps !target/release/examples !target/release/incremental - package-osx: + package-osx-intel: name: Package Mac OS X systems - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 - name: Install Rust @@ -54,18 +54,49 @@ jobs: - name: Build Packages run: | cd installer-scripts/osx/ - ./package.sh + ./package.sh intel - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.dist - path: installer-scripts/osx/sprig.dist + name: sprig_osx_intel.dist + path: installer-scripts/osx/working-dir-pkg/sprig.dist - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.pkg - path: installer-scripts/osx/sprig.pkg + name: sprig_osx_intel.pkg + path: installer-scripts/osx/working-dir-pkg/sprig.pkg - uses: actions/upload-artifact@v3 with: - name: sprig-target-directory-osx + name: sprig-target-directory-osx-intel + path: | + target/release/ + !target/release/.fingerprint + !target/release/build + !target/release/deps + !target/release/examples + !target/release/incremental + package-osx-arn: + name: Package Mac OS X systems (ARM) + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + - name: Install Rust + run: rustup update stable + - name: Build Rust Code + run: cargo build --release --all + - name: Build Packages + run: | + cd installer-scripts/osx/ + ./package.sh arm + - uses: actions/upload-artifact@v3 + with: + name: sprig_osx_arm.dist + path: installer-scripts/osx/working-dir-pkg/sprig.dist + - uses: actions/upload-artifact@v3 + with: + name: sprig_osx_arm.pkg + path: installer-scripts/osx/working-dir-pkg/sprig.pkg + - uses: actions/upload-artifact@v3 + with: + name: sprig-target-directory-osx-arm path: | target/release/ !target/release/.fingerprint @@ -96,19 +127,19 @@ jobs: nfpm package -p archlinux - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.deb + name: sprig_unix_amd64.deb path: installer-scripts/unix/sprig_0.0.6_amd64.deb - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.rpm + name: sprig_unix_amd64.rpm path: installer-scripts/unix/sprig-0.0.6-1.x86_64.rpm - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.apk + name: sprig_unix_amd64.apk path: installer-scripts/unix/sprig_0.0.6_x86_64.apk - uses: actions/upload-artifact@v3 with: - name: sprig_amd64.pkg.tar.zst + name: sprig_unix_amd64.pkg.tar.zst path: installer-scripts/unix/sprig-0.0.6-1-x86_64.pkg.tar.zst - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 5454cac..0585c67 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -50,7 +50,7 @@ jobs: name: Build strategy: matrix: - os: [ubuntu-22.04, windows-2022, macos-12] + os: [ubuntu-22.04, windows-2022, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -62,7 +62,7 @@ jobs: name: Run non doc tests strategy: matrix: - os: [ubuntu-22.04, windows-2022, macos-12] + os: [ubuntu-22.04, windows-2022, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -75,7 +75,7 @@ jobs: name: Run doc tests strategy: matrix: - os: [ubuntu-22.04, windows-2022, macos-12] + os: [ubuntu-22.04, windows-2022, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 189aebf..a56d60c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Package formats /installer-scripts/osx/working-dir/ +/installer-scripts/osx/working-dir-pkg/ /installer-scripts/win/.wix/ /installer-scripts/win/*.msi /installer-scripts/win/*.wixpdb diff --git a/installer-scripts/osx/package.sh b/installer-scripts/osx/package.sh index 3ecd068..002d40f 100755 --- a/installer-scripts/osx/package.sh +++ b/installer-scripts/osx/package.sh @@ -2,9 +2,18 @@ set -euo pipefail +ARCH="intel" +if [[ "$1" == "arm" ]]; then + ARCH="arm" +fi +echo "Building Mac Package for: [$ARCH]" + export SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" (rm -rf ./working-dir || true) +(rm -rf ./working-dir-pkg || true) + +echo "Preparing Directory to Package..." mkdir working-dir cd working-dir cp ../../../target/release/catlog ./ @@ -21,5 +30,15 @@ cp ../../../pkg/cat-dev/licenses/serial2-tokio-rs-apache.md ./ cp ../../../pkg/cat-dev/licenses/serial2-tokio-rs-bsd.md ./ cp ../../../LICENSE ./ cd ../ +echo "Done! Building...." + pkgbuild --root ./working-dir/ --identifier "dev.rem-verse.sprig" --version "0.0.6" --install-location "/usr/local/bin" sprig.pkg + +echo "Done! Preparing Distribution Directory..." +mkdir working-dir-pkg +cp "./distribution.${ARCH}.xml" "./working-dir-pkg/distribution.xml" +cp "./sprig.pkg" "./working-dir-pkg/sprig.pkg" +echo "Done! Building!" + +cd "./working-dir-pkg" productbuild --synthesize --package "sprig.pkg" sprig.dist \ No newline at end of file