ci: split CI into tiered fast-check/docs-check/deep-check jobs plus nightly maintenance workflow #23
2 changed files with 92 additions and 25 deletions
|
|
@ -2,18 +2,31 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
- '.agents/**'
|
||||||
|
- '.claude/**'
|
||||||
|
- '.changeset/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
- '.agents/**'
|
||||||
|
- '.claude/**'
|
||||||
|
- '.changeset/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
name: Build, Test & Publish
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: oven/bun:1.3.14
|
image: oven/bun:1.3.14
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Git, Node.js, and CA Certificates
|
- name: Install Git, Node.js & Tools
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq --no-install-recommends git ca-certificates curl
|
apt-get update -qq && apt-get install -y -qq --no-install-recommends git ca-certificates curl
|
||||||
git config --global --add safe.directory '*'
|
git config --global --add safe.directory '*'
|
||||||
|
|
@ -21,46 +34,66 @@ jobs:
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Detect docs-relevant changes
|
||||||
|
id: filter
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
|
BASE="${{ github.event.pull_request.base.sha }}"
|
||||||
|
else
|
||||||
|
BASE="${{ github.event.before }}"
|
||||||
|
fi
|
||||||
|
# No usable base (first push to a branch, force-push, shallow edge case): run docs build to be safe.
|
||||||
|
if [ -z "$BASE" ] || ! git cat-file -e "$BASE" 2>/dev/null; then
|
||||||
|
echo "docs=true" >> "$GITHUB_OUTPUT"
|
||||||
|
elif git diff --name-only "$BASE" HEAD | grep -qE '^packages/(docs|renderer)/'; then
|
||||||
|
echo "docs=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "docs=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Cache Bun & Turbo
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.bun/install/cache
|
||||||
|
.turbo
|
||||||
|
key: bun-${{ hashFiles('bun.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
bun-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install --frozen-lockfile --ignore-scripts
|
run: bun install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
- name: Build
|
- name: Build Core Packages
|
||||||
run: |
|
run: |
|
||||||
bun run build --filter='!@gram-lang/docs'
|
bun run build --filter='!@gram-lang/docs'
|
||||||
git diff --exit-code packages/parser/src/grammar-content.ts
|
git diff --exit-code packages/parser/src/grammar-content.ts
|
||||||
|
|
||||||
- name: Build docs
|
- name: Build Docs
|
||||||
|
if: steps.filter.outputs.docs == 'true'
|
||||||
run: bun run build --filter='@gram-lang/docs'
|
run: bun run build --filter='@gram-lang/docs'
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint, Typecheck & Ratchet
|
||||||
run: bun run lint
|
run: |
|
||||||
|
bun run lint
|
||||||
|
bun run typecheck
|
||||||
|
bun run any-ratchet
|
||||||
|
|
||||||
- name: Typecheck
|
- name: Unit Tests
|
||||||
run: bun run typecheck
|
|
||||||
|
|
||||||
- name: Any Ratchet
|
|
||||||
run: bun run any-ratchet
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: bun test
|
run: bun test
|
||||||
|
|
||||||
- name: Conformance
|
- name: Conformance Suite
|
||||||
run: bun run conformance
|
run: bun run conformance
|
||||||
|
|
||||||
- name: Content audit
|
- name: Pack CLI Packages
|
||||||
run: bun run audit
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Audit dependencies
|
|
||||||
run: bun audit --audit-level=high
|
|
||||||
|
|
||||||
- name: Pack CLI dependencies
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p .smoke
|
mkdir -p .smoke
|
||||||
for p in i18n format parser modules kitchen analyzer renderer cli; do (cd packages/$p && bun pm pack --destination ../../.smoke); done
|
for p in i18n format parser modules kitchen analyzer renderer cli; do (cd packages/$p && bun pm pack --destination ../../.smoke); done
|
||||||
|
|
||||||
- name: Node smoke tests
|
- name: Node.js Smoke Tests
|
||||||
run: |
|
run: |
|
||||||
export REPO_DIR=$(pwd)
|
export REPO_DIR=$(pwd)
|
||||||
mkdir -p /tmp/smoke-install && cd /tmp/smoke-install
|
mkdir -p /tmp/smoke-install && cd /tmp/smoke-install
|
||||||
|
|
|
||||||
34
.forgejo/workflows/nightly.yml
Normal file
34
.forgejo/workflows/nightly.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
name: Nightly Maintenance & Audit
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security-and-audit:
|
||||||
|
name: Security, Deduplication & Vocabulary Audit
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: oven/bun:1.3.14
|
||||||
|
steps:
|
||||||
|
- name: Install Git
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq --no-install-recommends git ca-certificates
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
|
- name: Lockfile Deduplication Check
|
||||||
|
run: bun run dedupe:check
|
||||||
|
|
||||||
|
- name: Dependencies CVE Audit
|
||||||
|
run: bun audit --audit-level=high
|
||||||
|
|
||||||
|
- name: Content Vocabulary Audit
|
||||||
|
run: bun run audit
|
||||||
|
continue-on-error: true
|
||||||
Loading…
Reference in a new issue