81 lines
2.4 KiB
YAML
81 lines
2.4 KiB
YAML
name: swift-macos-arm64
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
swift-macos-arm64:
|
|
runs-on: macos-arm64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Show toolchain versions
|
|
run: |
|
|
set -eu
|
|
sw_vers
|
|
xcodebuild -version
|
|
swift --version
|
|
|
|
- name: Install XcodeGen
|
|
run: |
|
|
set -eu
|
|
if ! command -v xcodegen >/dev/null 2>&1; then
|
|
brew install xcodegen
|
|
fi
|
|
xcodegen --version
|
|
|
|
- name: Generate Xcode project
|
|
run: |
|
|
set -eu
|
|
chmod +x ./scripts/generate-xcodeproj.sh
|
|
./scripts/generate-xcodeproj.sh
|
|
|
|
- name: Build app
|
|
run: |
|
|
set -eu
|
|
xcodebuild -project SwiftTrayDemo.xcodeproj \
|
|
-scheme SwiftTrayDemo \
|
|
-configuration Release \
|
|
-destination 'generic/platform=macOS' \
|
|
ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \
|
|
-derivedDataPath build/DerivedData \
|
|
build
|
|
|
|
- name: Package app
|
|
run: |
|
|
set -eux
|
|
rm -rf artifacts bundle-out
|
|
mkdir -p artifacts
|
|
app="build/DerivedData/Build/Products/Release/SwiftTrayDemo.app"
|
|
zip_name="swift-window-demo-macos-arm64-run${{ github.run_number }}.zip"
|
|
[ -d "$app" ] || { echo 'No SwiftTrayDemo.app produced'; exit 1; }
|
|
ditto -c -k --sequesterRsrc --keepParent "$app" "artifacts/$zip_name"
|
|
cp -R "$app" bundle-out
|
|
printf '%s\n' 'SwiftTrayDemo macOS app bundle.' > artifacts/README.txt
|
|
|
|
- name: Copy latest app to runner desktop
|
|
run: |
|
|
set -eux
|
|
dest="$HOME/Desktop/Builds/swift-tests"
|
|
mkdir -p "$dest"
|
|
find "$dest" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
|
|
ditto bundle-out/SwiftTrayDemo.app "$dest/SwiftTrayDemo.app"
|
|
cp artifacts/README.txt "$dest/"
|
|
printf '%s\n' \
|
|
'repo: swift-tests' \
|
|
'workflow: swift-macos-arm64.yml' \
|
|
'artifact: SwiftTrayDemo.app' \
|
|
"runner_app: $dest/SwiftTrayDemo.app" \
|
|
> "$dest/LATEST.txt"
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: SwiftTrayDemo-macos-arm64-run${{ github.run_number }}
|
|
path: artifacts/
|
|
retention-days: 14
|