Repository navigation
Use d2x 2026.10.21.1 and verify real first-use versions #67
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: Validate exercises and reference solutions | |
| # Full regression; fresh-install.yml separately covers unprepared first starts. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/**" | |
| - "solutions/**" | |
| - "d2x/**" | |
| - "mcpp.toml" | |
| - ".d2x.json" | |
| - ".xlings.json" | |
| - ".github/workflows/**" | |
| - ".github/actions/**" | |
| - ".devcontainer/**" | |
| - ".vscode/tasks.json" | |
| - "scripts/**" | |
| - "README*.md" | |
| - "docs/**" | |
| - "book/src/base/chapter_1.md" | |
| - "book/en/src/base/chapter_1.md" | |
| - "book/src/changelog.md" | |
| - "book/en/src/changelog.md" | |
| pull_request: | |
| paths: | |
| - "src/**" | |
| - "solutions/**" | |
| - "d2x/**" | |
| - "mcpp.toml" | |
| - ".d2x.json" | |
| - ".xlings.json" | |
| - ".github/workflows/**" | |
| - ".github/actions/**" | |
| - ".devcontainer/**" | |
| - ".vscode/tasks.json" | |
| - "scripts/**" | |
| - "README*.md" | |
| - "docs/**" | |
| - "book/src/base/chapter_1.md" | |
| - "book/en/src/base/chapter_1.md" | |
| - "book/src/changelog.md" | |
| - "book/en/src/changelog.md" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| XLINGS_NON_INTERACTIVE: "1" | |
| jobs: | |
| validate-exercises: | |
| name: validate (${{ matrix.name }}) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {name: linux, os: ubuntu-24.04, langs: all} | |
| - {name: macos-arm64, os: macos-14, langs: zh} | |
| - {name: windows-server-2022, os: windows-2022, langs: zh} | |
| - {name: windows-server-2025, os: windows-2025, langs: zh} | |
| - {name: windows-no-msvc, os: windows-2025, langs: zh, mask_msvc: true} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Mask MSVC | |
| if: matrix.mask_msvc | |
| shell: powershell | |
| run: ./scripts/ci/mask-msvc.ps1 | |
| - name: Prepare course (Unix) | |
| if: runner.os != 'Windows' | |
| run: python3 scripts/ci/prepare.py | |
| - name: Prepare course (Windows PowerShell 5.1) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: python scripts/ci/prepare.py | |
| - name: Assert MinGW fallback | |
| if: matrix.mask_msvc | |
| run: | | |
| mkdir -p .d2x/ci-logs | |
| # doctor returns nonzero for warnings too (missing MSVC is expected). | |
| mcpp self doctor > .d2x/ci-logs/doctor.txt 2>&1 || true | |
| cat .d2x/ci-logs/doctor.txt | |
| grep -q 'gcc.*what a build here uses' .d2x/ci-logs/doctor.txt | |
| grep -q 'payload mingw-gcc' .d2x/ci-logs/doctor.txt | |
| grep -q 'x86_64.*windows-gnu' .d2x/ci-logs/doctor.txt | |
| ls -d target/*windows-gnu | |
| - name: Exercise and reference answer regression | |
| run: bash d2x/buildtools/tests/e2e.sh ${{ matrix.langs }} | |
| - name: Checker completes the Chinese course | |
| run: bash d2x/buildtools/tests/checker-e2e.sh zh | |
| - name: Checker completes the English course | |
| if: matrix.langs == 'all' | |
| run: bash d2x/buildtools/tests/checker-e2e.sh en | |
| - name: Diagnostics | |
| if: failure() | |
| run: | | |
| mkdir -p .d2x/ci-logs | |
| mcpp self doctor > .d2x/ci-logs/doctor.txt 2>&1 || true | |
| mcpp toolchain list --format json > .d2x/ci-logs/toolchains.json 2>&1 || true | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: regression-${{ matrix.name }} | |
| path: | | |
| .d2x/ci-logs/ | |
| .d2x/checker-e2e.out | |
| if-no-files-found: ignore | |
| include-hidden-files: true | |
| solutions-parity: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify all exercises have exactly one reference answer | |
| run: python3 scripts/ci/check-project.py | |
| - name: Validate workflow syntax and expressions | |
| run: | | |
| cd "$RUNNER_TEMP" | |
| curl --retry 3 -fsSL https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz -o actionlint_1.7.12_linux_amd64.tar.gz | |
| curl --retry 3 -fsSL https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_checksums.txt -o actionlint-checksums.txt | |
| grep 'actionlint_1.7.12_linux_amd64.tar.gz$' actionlint-checksums.txt | sha256sum --check | |
| tar -xzf actionlint_1.7.12_linux_amd64.tar.gz actionlint | |
| cd "$GITHUB_WORKSPACE" | |
| "$RUNNER_TEMP/actionlint" -shellcheck= |