From 9f38693ddc7fb8043f0caf3d42e0b08031704b13 Mon Sep 17 00:00:00 2001 From: touka shiro Date: Sun, 27 Sep 2026 17:32:16 -0400 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=BE=9D=E5=AD=98=E3=82=92=E5=A4=89?= =?UTF-8?q?=E3=81=88=E3=82=8B=20PR=20=E3=81=A7=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=AE=E3=82=BF=E3=83=BC=E3=82=B2=E3=83=83=E3=83=88?= =?UTF-8?q?=EF=BC=88arm=E3=83=BBmusl=EF=BC=89=E3=82=82=E3=83=93=E3=83=AB?= =?UTF-8?q?=E3=83=89=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit arm64 / armhf / musl はタグを打ったときだけビルドしていたため、依存の更新で それらだけが壊れても、リリースまで気づけなかった。Cargo.toml などを変える PR (Renovate を含む)で、release.yml と同じターゲットを cross でビルドする。 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UyWFKfK7QhjFLgRBF1V9Bu --- .github/workflows/cross.yml | 49 +++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/cross.yml diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml new file mode 100644 index 0000000..636e92e --- /dev/null +++ b/.github/workflows/cross.yml @@ -0,0 +1,49 @@ +name: Cross build + +# Release targets are otherwise built only when a v* tag is pushed. Build them on +# pull requests that change dependencies (Renovate, manual upgrades) so an update +# that breaks only arm / musl is caught before it is merged. +on: + pull_request: + paths: + - Cargo.toml + - Cargo.lock + - Cross.toml + - .github/workflows/cross.yml + - .github/workflows/release.yml + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: cross-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: build ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # the same targets as release.yml (x86_64-unknown-linux-gnu is covered by ci.yml) + target: + - x86_64-unknown-linux-musl + - armv7-unknown-linux-gnueabihf + - armv7-unknown-linux-musleabihf + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: taiki-e/install-action@v2 + with: + tool: cross + - name: Build (release profile, like release.yml) + run: cross build --release --target ${{ matrix.target }} diff --git a/CLAUDE.md b/CLAUDE.md index 45d9c94..0908b77 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,6 +16,7 @@ cargo run # 設定は環境変数 RPROXY_* か .env(.env.e - 設定項目は `src/main.rs` の `Options`(clap)。すべて `RPROXY_*` 環境変数でも指定でき、起動時に `.env` を読む。項目を増やすときは `.env.example` と README の表も更新する。 - ring(rustls)のビルドには C コンパイラが要る。 +- `Cargo.toml` を変える PR(Renovate を含む)では `.github/workflows/cross.yml` がリリースと同じターゲット(arm・musl)をビルドする(ARM や musl だけで壊れる依存の更新を、マージ前に見つけるため)。 - リリースは `v*` タグの push で `.github/workflows/release.yml` が Linux の 6 ターゲット(x86_64・aarch64・armv7 の gnu と musl)向けにクロスビルドし、amd64 / arm64 / armhf の `.deb`(musl の静的リンク)を作って `gh-pages` の apt リポジトリに載せる。タグと `Cargo.toml` の `version` を揃えること。詳細は `docs/APT.md`。 - `scripts/install.sh` は VM 向けのインストーラ(root・systemd が前提。Debian / Ubuntu は apt、それ以外はリリースのバイナリ)。設定の雛形は `debian/rproxy.env` と `contrib/rproxy-api.service` を使う(チェックアウトから実行したときは手元のもの、curl で実行したときは GitHub のもの)。CI の `install.sh` ジョブ(`scripts/test-install.sh`)で実際に入れて確かめる。 - パッケージ(`debian/`、`[package.metadata.deb]`)を変えたら `cargo deb` で作り、CI の `Debian package` ジョブ(`scripts/test-deb.sh`。sudo でインストールするので手元では実行しない)で確かめる。`debian/rproxy-api.service` は `contrib/rproxy-api.service` と `ExecStart` 以外を揃える。