Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: macos-15
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- name: Show toolchain
run: swift --version

- name: Build
run: swift build -c release

- name: Test
# The machine-wide scan stays off: a GitHub runner ships Xcode and its
# simulator runtimes, so it is no faster there than on a developer Mac.
run: swift test

- name: Assemble the app bundle
run: scripts/build-app.sh

- name: Check the bundle is complete
run: |
app=build/SysDataMenu.app
test -x "$app/Contents/MacOS/SysDataMenu"
test -f "$app/Contents/Info.plist"
test -d "$app/Contents/Resources/SysDataMenu_SysDataMenu.bundle"
codesign --verify --deep --strict "$app"

- name: Check the compiled strings are up to date
# compile-strings.sh regenerates the .strings files from the catalog;
# a stale commit shows up here instead of as mixed languages at runtime.
run: |
scripts/compile-strings.sh
git diff --exit-code -- Sources/SysDataMenu/Resources
4 changes: 3 additions & 1 deletion scripts/build-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ identity=${CODESIGN_IDENTITY:-}
if [ -z "$identity" ]; then
identities=$(security find-identity -v -p codesigning 2>/dev/null)
for kind in "Developer ID Application" "Apple Development"; do
identity=$(printf '%s\n' "$identities" | grep -oE "\"${kind}[^\"]*\"" | head -1 | tr -d '"')
# `|| true`: grep exits 1 when the kind is absent, which would abort the
# script under `set -e` before the next kind is tried.
identity=$(printf '%s\n' "$identities" | grep -oE "\"${kind}[^\"]*\"" | head -1 | tr -d '"' || true)
[ -n "$identity" ] && break
done
fi
Expand Down