feat(ci): add macos arm ci pipeline

This commit is contained in:
Federico Terzi 2021-10-04 14:56:58 +02:00
parent 2979390ddf
commit a70dcdd7d2
3 changed files with 51 additions and 4 deletions

View File

@ -55,8 +55,6 @@ jobs:
- name: Install cargo-make - name: Install cargo-make
run: | run: |
cargo install --force cargo-make cargo install --force cargo-make
# - name: Run test suite
# run: cargo make test-binary --env BUILD_ARCH=aarch64-apple-darwin
- name: Build - name: Build
run: | run: |
cargo make build-macos-arm-binary cargo make build-macos-arm-binary

View File

@ -99,7 +99,7 @@ jobs:
macos-intel: macos-intel:
needs: ["extract-version"] needs: ["extract-version"]
runs-on: macos-latest runs-on: macos-11
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -129,6 +129,49 @@ jobs:
- name: Upload artifacts to Github Releases - name: Upload artifacts to Github Releases
run: | run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-Intel.zip Espanso-Mac-Intel.zip.sha256.txt gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-Intel.zip Espanso-Mac-Intel.zip.sha256.txt
macos-m1:
needs: ["extract-version"]
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Install cargo-make
run: |
cargo install --force cargo-make
- name: Build
run: cargo make create-bundle --profile release --env BUILD_ARCH=aarch64-apple-darwin
- name: Codesign executable
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 —decode > certificate.p12
security create-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain security default-keychain -s build.keychain
security unlock-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD build.keychain
/usr/bin/codesign --force -s "Espanso CI Self-Signed" target/mac/Espanso.app -v
- name: Create ZIP archive
run: |
ditto -c -k --sequesterRsrc --keepParent target/mac/Espanso.app Espanso-Mac-M1.zip
- name: Calculate hashes
run: |
shasum -a 256 Espanso-Mac-M1.zip > Espanso-Mac-M1.zip.sha256.txt
- uses: actions/upload-artifact@v2
name: "Upload artifacts"
with:
name: Mac M1 Artifacts
path: |
Espanso-Mac-M1.zip
Espanso-Mac-M1.zip.sha256.txt
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-M1.zip Espanso-Mac-M1.zip.sha256.txt
# macos-intel: # macos-intel:
# runs-on: macos-11 # runs-on: macos-11

View File

@ -1,5 +1,11 @@
set -e set -e
FINAL_EXEC_PATH=$EXEC_PATH
if [ $BUILD_ARCH != "current" ]; then
FINAL_EXEC_PATH=$(echo $EXEC_PATH | sed "s/target\//target\/$BUILD_ARCH\//g")
fi
TARGET_DIR=target/mac/Espanso.app TARGET_DIR=target/mac/Espanso.app
rm -Rf $TARGET_DIR rm -Rf $TARGET_DIR
@ -15,4 +21,4 @@ sed -e "s/VERSION/$VERSION/" espanso/src/res/macos/Info.plist > $TARGET_DIR/Cont
/bin/echo "APPL????" > $TARGET_DIR/Contents/PkgInfo /bin/echo "APPL????" > $TARGET_DIR/Contents/PkgInfo
cp -f espanso/src/res/macos/icon.icns $TARGET_DIR/Contents/Resources/icon.icns cp -f espanso/src/res/macos/icon.icns $TARGET_DIR/Contents/Resources/icon.icns
cp -f $EXEC_PATH $TARGET_DIR/Contents/MacOS/espanso cp -f $FINAL_EXEC_PATH $TARGET_DIR/Contents/MacOS/espanso