foundation/.forgejo/workflows/ecosystem-selftest.yml

67 lines
2.4 KiB
YAML
Raw Normal View History

# ecosystem-selftest — proves the foundation's ecosystem-CI capabilities on its own
# runner (documentation/999_testing.md), without depending on external candidate
# repos. Three self-contained jobs, each asserting an acceptance criterion:
# - semantic-release: the bump sequence 1.0.0→1.1.0→1.1.1→2.0.0→3.0.0
# - eslint-gate: an eslint error makes the job exit non-zero
# - yamllint-gate: a yamllint error makes the job exit non-zero
# Build-shape coverage (npm/bun/docker) is exercised by the reusable-* workflows
# against the real candidate repos; this file guards the capabilities that need no
# external repo. Runs in the baked foundation-ci image.
name: ecosystem-selftest
on:
push:
paths:
- "ci/**"
- ".forgejo/workflows/ecosystem-selftest.yml"
- "actions/**"
workflow_dispatch:
jobs:
semantic-release-bumptest:
runs-on: docker
container:
image: foundation-ci:latest
steps:
- uses: actions/checkout@v4
- name: semantic-release bump sequence
run: ./ci/semantic-release-bumptest.sh
eslint-gate:
runs-on: docker
container:
image: foundation-ci:latest
steps:
- uses: actions/checkout@v4
- name: an eslint error must fail the job (exit non-zero)
run: |
set -e
d=$(mktemp -d); cd "$d"
# flat config (eslint 9) with no-unused-vars as an error
cat > eslint.config.mjs <<'EOF'
export default [{ rules: { "no-unused-vars": "error" } }];
EOF
printf 'const x = 1;\n' > bad.js # x is unused → error
if eslint bad.js; then
echo "BUG: eslint passed on a file with an error"; exit 1
else
echo "OK: eslint exited non-zero on the lint error"
fi
yamllint-gate:
runs-on: docker
container:
image: foundation-ci:latest
steps:
- uses: actions/checkout@v4
- name: a yamllint error must fail the job (exit non-zero)
run: |
set -e
d=$(mktemp -d); cd "$d"
# duplicate key + bad indentation → yamllint error
printf 'a: 1\na: 2\n' > bad.yaml
if yamllint -d '{extends: default, rules: {document-start: disable}}' bad.yaml; then
echo "BUG: yamllint passed on a file with a duplicate key"; exit 1
else
echo "OK: yamllint exited non-zero on the lint error"
fi