From f9446bf689663ee5156704b57e3bdb9f205f862f Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:05:22 +0800 Subject: [PATCH 1/4] ci: run checks on pull requests only main only accepts squash merges of up-to-date branches, so the push run on main retested the same tree. Without it, the docs-only change filter no longer saves anything worth its extra job, so Build and test always runs. --- .github/workflows/ci.yml | 44 +++------------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e3d100..56941c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,58 +1,20 @@ name: CI +# Pull requests only: main requires squash merges of up-to-date branches, so the +# merged tree is the one this workflow already tested. on: - # No paths-ignore here: "Build and test" is a required check, so it must report on - # every pull request. Docs-only pull requests skip the job instead (see `changes`). pull_request: - push: - branches: - - main - paths-ignore: - - "**.md" - - "docs/**" concurrency: - group: ci-${{ github.event_name }}-${{ github.ref }} + group: ci-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: - changes: - name: Detect changes - if: github.event_name == 'pull_request' - runs-on: ubuntu-24.04 - timeout-minutes: 5 - permissions: - pull-requests: read - outputs: - code: ${{ steps.filter.outputs.code }} - steps: - # Only GitHub-owned actions are allowed in this repository, so filter with the gh CLI. - - name: Filter changed paths - id: filter - shell: bash - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number }} - run: | - files=$(gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename') - code=false - while IFS= read -r file; do - case "$file" in - *.md | docs/* | "") ;; - *) code=true ;; - esac - done <<< "$files" - echo "code=$code" >> "$GITHUB_OUTPUT" - check: name: Build and test - needs: changes - # A skipped job still satisfies the required check, so docs-only pull requests can merge. - # Skip only when the filter ran and found no code changes; any other outcome runs the build. - if: ${{ !cancelled() && !(needs.changes.result == 'success' && needs.changes.outputs.code == 'false') }} runs-on: macos-26 timeout-minutes: 15 steps: From fa65315f1fcb8028f90a9fc5ef790aa593dee691 Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:05:22 +0800 Subject: [PATCH 2/4] test: check the built binary in make test The architecture, deployment target, and AppKit checks ran only in the release workflow, so a regression surfaced at tag time. make test now runs them on every pull request, and the release workflow relies on it. --- .github/workflows/release.yml | 32 +++----------------------------- Makefile | 8 ++++++-- README.md | 3 ++- README.zh-CN.md | 2 +- tests/binary.sh | 30 ++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 33 deletions(-) create mode 100755 tests/binary.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42c587f..4626f6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,6 @@ concurrency: env: TARGET: aarch64-apple-darwin - EXPECTED_ARCH: arm64 - MINIMUM_MACOS: "26.0" jobs: build: @@ -63,41 +61,20 @@ jobs: clang --version xcrun --show-sdk-version + # make test also checks the version, architecture, and deployment target. - name: Build and test run: make all test - - name: Verify and package binary + - name: Package binary shell: bash env: VERSION: ${{ steps.version.outputs.version }} run: | set -euo pipefail - binary="build/ferry" - test -x "$binary" - - binary_archs="$(lipo -archs "$binary")" - test "$binary_archs" = "$EXPECTED_ARCH" || { - echo "Expected $EXPECTED_ARCH binary, got $binary_archs" >&2 - exit 1 - } - - minos="$(otool -l "$binary" | awk '$1 == "minos" { print $2; exit }')" - test "$minos" = "$MINIMUM_MACOS" || { - echo "Expected minimum macOS $MINIMUM_MACOS, got $minos" >&2 - exit 1 - } - - otool -L "$binary" | grep -q "/AppKit.framework/" || { - echo "The binary must link AppKit" >&2 - exit 1 - } - - test "$("$binary" --version)" = "ferry $VERSION" - package_dir="$RUNNER_TEMP/package-$TARGET" dist_dir="$RUNNER_TEMP/dist-$TARGET" mkdir -p "$package_dir" "$dist_dir" - install -m 0755 "$binary" "$package_dir/ferry" + install -m 0755 build/ferry "$package_dir/ferry" install -m 0644 LICENSE "$package_dir/LICENSE" archive="ferry-v$VERSION-$TARGET.tar.gz" @@ -242,9 +219,6 @@ jobs: brew install softmaxe/release-test/ferry brew test softmaxe/release-test/ferry - installed_archs="$(lipo -archs "$(brew --prefix ferry)/bin/ferry")" - test "$installed_archs" = "$EXPECTED_ARCH" - tap-sync: name: Update Homebrew tap needs: diff --git a/Makefile b/Makefile index 59d0630..78977a1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ VERSION = 0.0.1 +ARCH = arm64 +MACOS_MIN = 26.0 + CC ?= clang CFLAGS ?= -O2 -CFLAGS += -Wall -Wextra -fno-objc-arc -arch arm64 \ - -mmacosx-version-min=26.0 -DFERRY_VERSION='"$(VERSION)"' +CFLAGS += -Wall -Wextra -fno-objc-arc -arch $(ARCH) \ + -mmacosx-version-min=$(MACOS_MIN) -DFERRY_VERSION='"$(VERSION)"' # AppKit is linked although no AppKit API is called: the window server ignores # the bridged move operation from processes that have not loaded it. FRAMEWORKS = -framework AppKit -framework ApplicationServices \ @@ -22,6 +25,7 @@ $(BIN): src/ferry.m Makefile test: $(BIN) tests/cli.sh $(BIN) $(VERSION) + tests/binary.sh $(BIN) $(ARCH) $(MACOS_MIN) # Requires a live desktop and Accessibility; temporarily switches Spaces. test-follow: $(BIN) build/follow-test diff --git a/README.md b/README.md index 76a7f7d..ad9317f 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,8 @@ make test make install PREFIX="$HOME/.local" ``` -`make test` checks the command-line interface only. It does not move windows. +`make test` checks the command-line interface and the built binary's architecture, +deployment target, and linked frameworks. It does not move windows. `make test-follow` runs the live desktop regression for background `--window` commands. It requires Accessibility and two normal Spaces on the active display, creates temporary test windows, and temporarily switches Spaces. It closes the diff --git a/README.zh-CN.md b/README.zh-CN.md index 6b5f551..a638402 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -131,7 +131,7 @@ make test make install PREFIX="$HOME/.local" ``` -`make test` 只检查命令行接口,不会移动窗口。`make test-follow` 针对后台 `--window` 命令运行真实桌面回归测试。它需要辅助功能权限,且当前显示器上有两个普通 Space;测试会创建临时测试窗口并临时切换 Space,结束后关闭测试窗口并恢复原来的 App。 +`make test` 只检查命令行接口和构建产物的架构、最低系统版本及链接的框架,不会移动窗口。`make test-follow` 针对后台 `--window` 命令运行真实桌面回归测试。它需要辅助功能权限,且当前显示器上有两个普通 Space;测试会创建临时测试窗口并临时切换 Space,结束后关闭测试窗口并恢复原来的 App。 ### 升级和卸载 diff --git a/tests/binary.sh b/tests/binary.sh new file mode 100755 index 0000000..0fdbfff --- /dev/null +++ b/tests/binary.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Build output tests: the shipped binary must match the architecture and +# deployment target in the Makefile and link AppKit. + +set -euo pipefail + +binary="${1:?usage: tests/binary.sh }" +arch="${2:?usage: tests/binary.sh }" +minimum_macos="${3:?usage: tests/binary.sh }" +failures=0 + +check() { + local name="$1" expected="$2" actual="$3" + + if [[ "$actual" != "$expected" ]]; then + echo "FAIL: $name: expected $expected, got $actual" >&2 + failures=$((failures + 1)) + else + echo "ok: $name" + fi +} + +check "architecture" "$arch" "$(lipo -archs "$binary")" +check "minimum macOS" "$minimum_macos" "$(otool -l "$binary" | awk '$1 == "minos" { print $2; exit }')" +check "links AppKit" "yes" "$(otool -L "$binary" | grep -q '/AppKit.framework/' && echo yes || echo no)" + +if ((failures)); then + echo "$failures test(s) failed" >&2 + exit 1 +fi From 6d448021e3ba48c699924cede68112013be9f158 Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:05:22 +0800 Subject: [PATCH 3/4] ci(release): drop tap-sync checks that cannot fail The tap is a fresh checkout and only Formula/ferry.rb is staged, so the working tree and staged path assertions always passed. --- .github/workflows/release.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4626f6c..b16dad6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -272,23 +272,12 @@ jobs: fi install -m 0644 ../formula/ferry.rb Formula/ferry.rb - - status_paths="$(git status --porcelain=v1 --untracked-files=all | awk '{ print $2 }' | LC_ALL=C sort -u)" - if [[ -n "$status_paths" && "$status_paths" != "Formula/ferry.rb" ]]; then - echo "Unexpected Homebrew tap changes:" >&2 - git status --short >&2 - exit 1 - fi - git add Formula/ferry.rb if git diff --cached --quiet; then echo "Formula/ferry.rb is already current" exit 0 fi - - git diff --cached --check - test "$(git diff --cached --name-only)" = "Formula/ferry.rb" - git diff --cached -- Formula/ferry.rb + git diff --cached git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" From 55e0c8fc839055a8a3853ad41132855ea7af3310 Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:05:22 +0800 Subject: [PATCH 4/4] ci(dependabot): wait a week before adopting action releases --- .github/dependabot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2336e19..e9d12b6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,9 @@ updates: directory: / schedule: interval: monthly + # Let new action releases age a week before adopting them. + cooldown: + default-days: 7 groups: actions: patterns: