-
Notifications
You must be signed in to change notification settings - Fork 4
128 lines (122 loc) · 4.6 KB
/
tests.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: All checks
run-name: "[${{ github.ref_name }}] All checks"
on:
workflow_dispatch:
push:
branches:
- main
- "runci/**"
pull_request:
branches:
- main
schedule:
# 04:00 every Tuesday morning
- cron: "0 4 * * 2"
jobs:
tests:
name: Run ${{ matrix.session }}
strategy:
fail-fast: false
matrix:
include:
- { python: "3.11", os: "ubuntu-22.04", session: "pre-commit" }
- { python: "3.10", os: "ubuntu-22.04", session: "tests" }
- { python: "3.10", os: "macos-12", session: "tests" }
- { python: "3.11", os: "macos-12", session: "mypy" }
- { python: "3.10", os: "windows-2022", session: "tests" }
- { python: "3.10", os: "macos-12", session: "tests" }
- { python: "3.11", os: "windows-2022", session: "tests" }
- { python: "3.11", os: "ubuntu-22.04", session: "tests" }
- { python: "3.11", os: "macos-12", session: "tests" }
- { python: "3.12", os: "windows-2022", session: "tests" }
- { python: "3.12", os: "ubuntu-22.04", session: "tests" }
- { python: "3.12", os: "macos-12", session: "tests" }
- { python: "3.11", os: "ubuntu-22.04", session: "docs-build" }
uses: ./.github/workflows/nox-session.yml
with:
python-version: ${{ matrix.python }}
os: ${{ matrix.os }}
nox-session: ${{ matrix.session }}
pytket-use-latest-pre-release: false
tests-with-coverage:
name: Run ${{ matrix.session }}
strategy:
fail-fast: false
matrix:
include:
- { python: "3.11", os: "ubuntu-22.04", session: "tests" }
uses: ./.github/workflows/nox-session.yml
with:
python-version: ${{ matrix.python }}
os: ${{ matrix.os }}
nox-session: ${{ matrix.session }}
generate-coverage-report: true
pytket-use-latest-pre-release: false
check-for-pytket-pre-release:
name: Check for pytket pre-release
runs-on: "ubuntu-22.04"
outputs:
pre-release-exists: ${{ steps.check-pytket-prerelease.outputs.PRE_RELEASE_EXISTS }}
steps:
- name: Version checks
id: check-pytket-prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eo pipefail
pip install lastversion
LATEST_STABLE_RELEASE=$(lastversion CQCL/tket --at github)
LATEST_RELEASE=$(lastversion --pre CQCL/tket --at github)
echo "Latest pytket release: ${LATEST_RELEASE}"
echo "Latest stable release: ${LATEST_STABLE_RELEASE}"
if [ ${LATEST_STABLE_RELEASE} == ${LATEST_RELEASE} ]; then
echo "Latest version is not a pre-release. Skipping pre-release checks"
echo "PRE_RELEASE_EXISTS=false" >> $GITHUB_OUTPUT
else
echo "Latest pytket version is a pre-release. Running pre-release checks"
echo "PRE_RELEASE_EXISTS=true" >> $GITHUB_OUTPUT
fi
tests-pre-release:
name: Run ${{ matrix.session }} (pre-release)
needs: check-for-pytket-pre-release
if: needs.check-for-pytket-pre-release.outputs.pre-release-exists == 'true'
strategy:
fail-fast: false
matrix:
include:
- { python: "3.10", os: "windows-2022", session: "tests" }
- { python: "3.10", os: "ubuntu-22.04", session: "tests" }
- { python: "3.10", os: "macos-12", session: "tests" }
- { python: "3.11", os: "windows-2022", session: "tests" }
- { python: "3.11", os: "ubuntu-22.04", session: "tests" }
- { python: "3.11", os: "macos-12", session: "tests" }
- { python: "3.12", os: "windows-2022", session: "tests" }
- { python: "3.12", os: "ubuntu-22.04", session: "tests" }
- { python: "3.12", os: "macos-12", session: "tests" }
uses: ./.github/workflows/nox-session.yml
with:
python-version: ${{ matrix.python }}
os: ${{ matrix.os }}
nox-session: ${{ matrix.session }}
pytket-use-latest-pre-release: true
all-test-jobs-succeeded:
name: All tests succeeded
needs:
- tests
- tests-with-coverage
- check-for-pytket-pre-release
- tests-pre-release
if: always()
runs-on: ubuntu-22.04
steps:
- shell: python
name: Check job results
run: |
results = [
"${{ needs.tests.result }}",
"${{ needs.tests-with-coverage.result }}",
"${{ needs.check-for-pytket-pre-release.result }}",
"${{ needs.tests-pre-release.result }}"
]
if "failure" in results or "cancelled" in results:
raise Exception