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
52 changes: 43 additions & 9 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
name: Quality
on:
pull_request:
# Only repository writers may schedule code on the shared runner pool.
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: quality-${{ github.ref }}
cancel-in-progress: true
jobs:
contract:
runs-on: ubuntu-24.04
runs-on: [self-hosted, 1msg-ci-heavy]
timeout-minutes: 45
env:
RUNNER_TOOL_CACHE: /tmp/sdk-tools-${{ github.run_id }}-${{ github.run_attempt }}
SDK_INSTALL_PREFIX: /tmp/sdk-install-${{ github.run_id }}-${{ github.run_attempt }}
# Native packages are installed only inside this disposable job container.
container:
image: ubuntu:24.04@sha256:2198e4c65076e9cb0b3d695219df667c0e3b0072da64ca3c2648aca17dcecaf5
defaults:
run:
shell: bash
steps:
- name: Prepare the isolated native toolchain environment
run: |
echo "CI_WORKSPACE_OWNER=$(stat -c '%u:%g' "$GITHUB_WORKSPACE/..")" >> "$GITHUB_ENV"
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential ca-certificates curl git gzip lsb-release sudo tar unzip xz-utils
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "26.13.1"
Expand All @@ -39,12 +57,12 @@ jobs:
- run: pnpm run lint:duplicates:full
- run: node quality/generator/generate.mjs
- run: node quality/generator/verify-negative.mjs
- run: sudo apt-get update && sudo apt-get install -y libcpprest-dev libboost-all-dev cmake ninja-build
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libcpprest-dev libboost-all-dev cmake ninja-build
- run: cmake -S quality -B .quality-build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
- run: cmake --build .quality-build --parallel 2
- run: ctest --test-dir .quality-build --output-on-failure
- run: cmake --install .quality-build/sdk --prefix "${{ runner.temp }}/sdk-install"
- run: cmake -S quality/consumer -B .quality-build/consumer -DCMAKE_PREFIX_PATH="${{ runner.temp }}/sdk-install"
- run: cmake --install .quality-build/sdk --prefix "$SDK_INSTALL_PREFIX"
- run: cmake -S quality/consumer -B .quality-build/consumer -DCMAKE_PREFIX_PATH="$SDK_INSTALL_PREFIX"
- run: cmake --build .quality-build/consumer --parallel 2
- run: ctest --test-dir .quality-build/consumer --output-on-failure
- uses: actions/upload-artifact@v4
Expand All @@ -55,11 +73,27 @@ jobs:
quality/generator/provenance.json
quality/generator/inventory.json
quality/reports/
- name: Restore ownership of this job's mounted files
if: always()
env:
PNPM_INSTALL_DIR: ${{ runner.temp }}/pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
run: |
if [ -n "${CI_WORKSPACE_OWNER:-}" ]; then
for directory in "$GITHUB_WORKSPACE" "$PNPM_INSTALL_DIR"; do
if [ -d "$directory" ]; then
chown -hR "$CI_WORKSPACE_OWNER" "$directory"
fi
done
# GitHub mounts only this job's temporary home at /github/home.
if [ "$HOME" = /github/home ]; then
chown -hR "$CI_WORKSPACE_OWNER" "$HOME"
fi
fi
quality-required:
if: always()
needs: [contract]
runs-on: ubuntu-24.04
runs-on: [self-hosted, 1msg-ci]
steps:
- env:
RESULTS: ${{ toJSON(needs) }}
run: node -e 'const jobs=JSON.parse(process.env.RESULTS); if(!Object.values(jobs).every(job=>job.result==="success")) process.exit(1)'
CONTRACT_RESULT: ${{ needs.contract.result }}
run: test "$CONTRACT_RESULT" = success
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Use Node 26.13.1 for tooling and `pnpm --dir tools/quality --ignore-workspace in
The `quality-required` aggregate fails if any required job is failed, skipped or cancelled. Repository branch protection must require that check; a workflow file alone does not configure GitHub protection. No generation/build/publish command may swallow errors.

`tools/quality` is a checksum-sealed versioned vendor preset, validated by its own executable tests and integrity check; Knip analyzes the consumer tooling graph and excludes that nested vendor workspace. `java` is the explicitly provisioned native generator runtime (CI Temurin24), not an npm package; its pinned generator JAR checksum is mandatory. No authored consumer source is excluded.

CI runs on the existing self-hosted pools: `1msg-ci-heavy` executes the native contract in a digest-pinned disposable Ubuntu 24.04 container, and `1msg-ci` only evaluates its result. Install operating-system packages inside the job container, never on the shared runner host. Keep the pnpm installer path unique per job, put native installs and the runner tool cache inside the container /tmp, and restore ownership of the checkout, pnpm installation and mounted container home after container work. Native fixtures, generator replay and all required quality checks remain mandatory.

Quality runs on repository pushes and manual dispatch, so same-repository PR heads receive the required checks without executing fork PR code. A maintainer must review a fork change and copy it to a repository-owned branch before scheduling the native contract. Keep external-contributor approval enabled; do not add `pull_request` or `pull_request_target` as a shortcut around this execution boundary.
Loading