feat(matrix): 過去ログの取り込みを有効にする (ログイン前に決める必要がある) #1256
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| # gh 非依存な CI 本体。ビルド対象/チェックはすべて om.yaml + flake 出力に宣言し、 | |
| # ここは「Nix を入れて om ci を回すだけ」の薄いプロバイダアダプタに留める。 | |
| # 同じ `om ci run` は Forgejo / GitLab / ローカルでもそのまま使える。 | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'nix/**' | |
| - 'configs/**' | |
| - 'secrets/**' | |
| - 'scripts/**' | |
| - 'docs/NIXOS_*.md' | |
| - 'Justfile' | |
| - '.statix.toml' | |
| - '.gitleaks.toml' | |
| - 'om.yaml' | |
| - '.github/actions/setup-nix/**' | |
| - '.github/workflows/ci.yml' | |
| pull_request: | |
| paths: | |
| - 'nix/**' | |
| - 'configs/**' | |
| - 'secrets/**' | |
| - 'scripts/**' | |
| - 'docs/NIXOS_*.md' | |
| - 'Justfile' | |
| - '.statix.toml' | |
| - '.gitleaks.toml' | |
| - 'om.yaml' | |
| - '.github/actions/setup-nix/**' | |
| - '.github/workflows/ci.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Which systems this run has to build. Pushes to main always build every system; a pull | |
| # request narrows it only when every path it touches names one side unambiguously | |
| # (scripts/ci-plan-systems.sh, with its own --demo self-check). The default is everything, | |
| # because almost anything under nix/modules or configs reaches every host. | |
| plan: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| systems: ${{ steps.plan.outputs.systems }} | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: plan | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| systems=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD" \ | |
| | ./scripts/ci-plan-systems.sh) | |
| else | |
| systems=$(./scripts/ci-plan-systems.sh </dev/null) | |
| fi | |
| echo "systems=$systems" >>"$GITHUB_OUTPUT" | |
| echo "building for: $systems" | |
| om-ci: | |
| name: om ci (${{ matrix.system }}) | |
| needs: plan | |
| strategy: | |
| # 1 system が落ちたら残りを即キャンセルして無駄な CI 時間/課金を抑える。 | |
| # 全 system の失敗を一度に見たいときは workflow_dispatch で cold-build を回す。 | |
| fail-fast: true | |
| # system -> runner の対応だけがプロバイダ固有。main では omnix が各 system の全出力 | |
| # (packages/checks/darwin+nixos configs/home activationPackage) を回し、PR では | |
| # 日常機だけの pr-gate を作る。system に依らないリンタ類は下の checks ジョブに分離。 | |
| matrix: | |
| system: ${{ fromJSON(needs.plan.outputs.systems) }} | |
| include: | |
| - system: x86_64-linux | |
| runner: ubuntu-24.04 | |
| - system: aarch64-linux | |
| runner: ubuntu-24.04-arm | |
| - system: aarch64-darwin | |
| runner: macos-14 | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| with: | |
| fetch-depth: 0 # gitleaks detect が全履歴を走査するため必須 | |
| # cachix (gapul-dotfiles) を pull+push。token があるジョブ (owner の push/main) | |
| # は build 出力を push し、以降の run と各実機 dev で共有する。fork PR は | |
| # secret 不可なので pull のみ。詳細は setup-nix/action.yml を参照。 | |
| - uses: ./.github/actions/setup-nix | |
| with: | |
| cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| mocopi-deploy-key: ${{ secrets.MOCOPI_DEPLOY_KEY }} | |
| # PR は日常機だけを検証する (packages.<system>.pr-gate)。omnix は subflake の全出力を | |
| # 作る仕様で出力を選べないため、PR 用の部分集合は flake 側の集約パッケージで表現し、 | |
| # ここでは素の nix build で叩く。macmini closure / NixOS 群 / VM テストは下の main | |
| # 側で作られ、cachix もそこで埋まる。 | |
| - name: nix build (pr-gate) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| nix --accept-flake-config build ./nix#packages.${{ matrix.system }}.pr-gate \ | |
| --no-link --print-build-logs | |
| # omnix 本体は om.cachix.org から取得 (--accept-flake-config)。ソースビルドしない。 | |
| - name: om ci run | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| nix --accept-flake-config run github:juspay/omnix/v1.3.2 -- \ | |
| ci run \ | |
| --systems "${{ matrix.system }}" \ | |
| --extra-access-tokens ${{ secrets.GITHUB_TOKEN }} \ | |
| -- --accept-flake-config | |
| # system に依らない検査 (lint / gitleaks / generated-drift)。om ci の build/flake-check は | |
| # om.yaml の checks 構成側で無効にしてあるので、ここは custom step だけを回す。 | |
| # 独立ジョブにしているのは、どの system ジョブに相乗りさせても、そのジョブがそのまま | |
| # CI 全体の長い棒になるため (実測: darwin へ載せると 7m、x86_64-linux へ載せると 6m)。 | |
| checks: | |
| name: checks (lint / gitleaks / generated) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| with: | |
| fetch-depth: 0 # gitleaks detect が全履歴を走査するため必須 | |
| - uses: ./.github/actions/setup-nix | |
| with: | |
| cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| mocopi-deploy-key: ${{ secrets.MOCOPI_DEPLOY_KEY }} | |
| - name: om ci run (checks) | |
| run: | | |
| nix --accept-flake-config run github:juspay/omnix/v1.3.2 -- \ | |
| ci run .#checks \ | |
| --systems x86_64-linux \ | |
| --extra-access-tokens ${{ secrets.GITHUB_TOKEN }} \ | |
| -- --accept-flake-config |