-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (130 loc) · 3.99 KB
/
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Tests
on:
push:
branches:
- master
pull_request:
jobs:
lint:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.2"
- name: Install tox
run: pip install tox
- name: run tox lint and type
run: tox -e lint,type
unit-test:
name: Unit testing
needs: lint
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-13 # runs x64
- macos-14 # runs arm64
- windows-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.os }}
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.2"
- name: Install tox
run: pip install tox
- name: run tox test
run: tox -e test
e2e-test:
name: End to End testing
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
backend-name:
- "Stubbed"
- "QX emulator"
env:
E2E_USERNAME: ${{ secrets.E2E_USERNAME }}
E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }}
IDP_URL: https://quantum-inspire-staging.eu.auth0.com
IDP_CLIENT_ID_E2E_TEST: Yz7ni9PUAyT43eUASZfmc1yqI66QxLUJ
COMPUTE_JOB_MANAGER_API_AUDIENCE: compute-job-manager
QI2_default_host: https://staging.qi2.quantum-inspire.com
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.2"
- name: Create folder
run: mkdir -p /scripts
- name: Get authentication token
run: |
python -m venv env
. ./env/bin/activate
pip install git+https://github.com/QuTech-Delft/quantuminspire2.git
curl https://raw.githubusercontent.com/QuTech-Delft/GitHub-Actions/refs/heads/feature/QI2-1222/include-auth-script/scripts/get_oauth_tokens.py > get_oauth_tokens.py
mkdir -p ~/.quantuminspire
python $CI_ROOT/scripts/get_oauth_tokens.py > ~/.quantuminspire/config.json
deactivate
working-directory: /scripts
- name: Install packages
run: poetry install
- name: Run e2e test
run: poetry run python tests/e2e_test.py "${{ matrix.backend-name }}"
complete:
# see https://github.community/t/status-check-for-a-matrix-jobs/127354/7
name: Report status
needs: [lint, unit-test, e2e-test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check all job status
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
run: exit 1
auto-merge-dependabot:
name: Auto merge dependabot PR
needs: complete
if: ${{ (github.event_name == 'pull_request') && (github.actor == 'dependabot[bot]') }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Squash and Merge PR from dependabot
uses: fastify/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
merge-method: squash