Skip to content

[QI2-1223] Call reusable authentication script for e2e #311

[QI2-1223] Call reusable authentication script for e2e

[QI2-1223] Call reusable authentication script for e2e #311

Workflow file for this run

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