try to use reusable workflows from current branch #1
This file contains 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: Build and test the compiler | ||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
required: true | ||
type: string | ||
chapter: | ||
required: true | ||
type: number | ||
jobs: | ||
build: | ||
uses: nlsandler/nqcc2/.github/workflows/build.yaml | ||
with: | ||
chapter: ${{ inputs.chapter }} | ||
os: ${{ inputs.os }} | ||
test: | ||
runs-on: ${{ inputs.os }} | ||
needs: [build] | ||
env: | ||
CHAPTER: ${{ inputs.chapter }} | ||
steps: | ||
- name: Check out tests | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: nlsandler/writing-a-c-compiler-tests | ||
ref: complete-test-suite # TODO use main once this is merged | ||
- name: Check out test runner script | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: nlsandler/nqcc2 | ||
sparse-checkout: | | ||
.github/run-tests.sh | ||
sparse-checkout-cone-mode: false | ||
- name: Download the compiler | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nqcc-${{inputs.os}}-${{ inputs.chapter }} | ||
path: nqcc | ||
# make NQCC executable | ||
- run: chmod u+x nqcc/main.exe | ||
# Invoke the run-tests script to test each intermediate stage | ||
# use Rosetta on macOS since that's what most readers are doing | ||
- name: Run the tests (Apple Silicon) | ||
if: runner.arch == 'ARM64' | ||
run: arch -x86_64 ./github/run-tests.sh | ||
- name: Run the tests (x86-64) | ||
if: runner.arch != 'ARM64' | ||
run: ./github/run-tests.sh | ||