GitCorner

Code

ossartcraftdeckcraft🌐
e4f86d11fe8a
name: CI

# Quality gates for every push to main and every pull request (`cargo xtask ci`), through the
# suite's shared gate workflow in craft-common-actions.
on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

# A newer push to a PR branch cancels its older run; every push to main runs to the end.
concurrency:
  group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  # Keep the early manifest preflight separate from the reusable workflow. The shared gate
  # also runs with require-craft-fonts: true, so the build script enforces actual required faces.
  # Keep this pin identical to gate, freebsd.yml and release.yml.
  font-pin:
    runs-on: ubuntu-latest
    env:
      # Same craft-fonts commit as release.yml.
      CRAFT_FONTS_REF: 37827adc41fd165f9a9234ac40f94dbad353aa69
    steps:
      - name: Harden runner
        uses: step-security/harden-runner@v2.22.4
        with:
          egress-policy: audit
      - name: Check out craft-fonts
        uses: actions/checkout@v7.0.1
        with:
          repository: storytold/craft-fonts
          ref: ${{ env.CRAFT_FONTS_REF }}
          path: craft-fonts
      - name: Font pin gate
        env:
          # The only pin allowed to predate the reviewed Chinese manifest. It is a sentinel, not
          # a proposed future SHA; update it together with all three workflow pins.
          PENDING_CRAFT_FONTS_PIN: 43913056ce82a3fdad0ef69f6b88d1dc922a8104
        run: |
          manifest="$GITHUB_WORKSPACE/craft-fonts/fonts/simplified-chinese-manifest.txt"
          if [ -f "$manifest" ]; then
            echo "craft-fonts pin carries the reviewed simplified-Chinese manifest."
          elif [ "$CRAFT_FONTS_REF" = "$PENDING_CRAFT_FONTS_PIN" ]; then
            echo "::warning title=craft-fonts pin pending::The pinned craft-fonts commit has no fonts/simplified-chinese-manifest.txt, so CJK checks may skip. Advance ci.yml, freebsd.yml and release.yml together to the reviewed immutable SHA before claiming shipped Chinese fonts."
          else
            echo "::error title=craft-fonts pin missing Chinese manifest::CRAFT_FONTS_REF advanced past the known pending pin ($PENDING_CRAFT_FONTS_PIN) but still has no fonts/simplified-chinese-manifest.txt. Update the pin to the reviewed commit that carries it."
            exit 1
          fi

  gate:
    needs: font-pin
    # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
    uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
    with:
      # Same craft-fonts commit as release.yml.
      craft-fonts-ref: 37827adc41fd165f9a9234ac40f94dbad353aa69
      require-craft-fonts: true
      packages: >-
        libasound2-dev libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev
        libgl1-mesa-dev