-
Notifications
You must be signed in to change notification settings - Fork 26
114 lines (96 loc) · 3.33 KB
/
test_tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# This workflow will test out our test suite; yes, it is a test for our tests
# It runs the unit tests in tests/test_tests, and runs the whole test script to validate its results
name: Compiler Test Suite CI
on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-final-nqcc:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, macos-latest]
uses: nlsandler/nqcc2/.github/workflows/build.yaml@main
with:
chapter: 20
os: ${{ matrix.os }}
build-partial-nqcc:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, macos-latest]
uses: nlsandler/nqcc2/.github/workflows/build.yaml@main
with:
chapter: 19
os: ${{ matrix.os }}
test:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.12"] #, "3.9", "3.10", "3.11"]
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]
runs-on: ${{ matrix.os }}
needs: [build-final-nqcc, build-partial-nqcc]
env:
# workaround for the fact that we can't build NQCC on Ubuntu 24.04 (https://github.com/actions/runner-images/issues/10476)
# use NQCC build in ubuntu-22.04 runner when running tests in Ubuntu 24.04
NQCC_OS: ${{ matrix.os == 'ubuntu-24.04' && 'ubuntu-22.04' || matrix.os }}
steps:
# now checkout test suite
- uses: actions/checkout@v4
with:
path: tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# next, download both versions of NQCC
- name: Get final NQCC
uses: actions/download-artifact@v4
with:
name: nqcc-${{ env.NQCC_OS }}-20
path: nqcc
- name: Get partial NQCC
uses: actions/download-artifact@v4
with:
name: nqcc-${{ env.NQCC_OS }}-19
path: nqcc-partial
- name: Make NQCC executable
run: |
chmod u+x "$NQCC"
chmod u+x "$NQCC_PARTIAL"
working-directory: tests
env:
NQCC: ${{ github.workspace }}/nqcc/main.exe
NQCC_PARTIAL: ${{ github.workspace }}/nqcc-partial/main.exe
# run the test suite
# use Rosetta on macOS (instead of just using an x86_64 Github runner)
# because that's probably what most readers are doing
- name: Test the test suite (macOS M1)
if: runner.arch == 'ARM64'
run: arch -x86_64 python -m unittest
working-directory: tests
env:
NQCC: ${{ github.workspace }}/nqcc/main.exe
NQCC_PARTIAL: ${{ github.workspace }}/nqcc-partial/main.exe
- name: Test the test suite (x86-64)
if: runner.arch != 'ARM64'
run: python -m unittest
working-directory: tests
env:
NQCC: ${{ github.workspace }}/nqcc/main.exe
NQCC_PARTIAL: ${{ github.workspace }}/nqcc-partial/main.exe
# Linting
- name: Install linter dependencies
# note: we do this _after_ running tests, b/c tests should work without
# these linters or their dependencies (e.g. typing_extensions)
run: |
python -m pip install --upgrade pip
python -m pip install mypy pylint
- name: Lint with mypy and pylint
run: |
# stop the build if there are errors
pylint -E tests/test_framework
# stop the build if there are type errors
mypy tests/test_framework --strict