Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: E2E Test

description: Run an E2E test suite

env:
test_results_path: coverage-devhub-tests-results.html

on:
workflow_dispatch:
inputs:
artifact_name:
description: 'Name for the uploaded artifact'
required: false
default: 'test-results'
pytest_marker:
description: 'Pytest marker expression (-m)'
required: false
default: ''
pytest_parallel:
description: 'The number of parallel tests to run'
required: false
default: '1'
pytest_path:
description: 'The path to the test to run'
required: true
default: ''
pytest_report:
description: 'Name for the HTML report file'
required: false
default: 'test-results.html'
pytest_reruns:
description: 'The number of times to rerun the tests'
required: false
default: '2'
pytest_variables:
description: 'The path to the variables file'
type: choice
required: true
options:
- dev.json
- stage.json
- prod.json
python_version:
description: 'The Python version to use'
required: false
default: '3.x'
workflow_call:
inputs:
artifact_name:
required: true
type: string
pytest_marker:
required: false
type: string
default: ''
pytest_parallel:
required: true
type: string
pytest_path:
required: true
type: string
pytest_report:
required: true
type: string
pytest_reruns:
required: true
type: string
pytest_variables:
required: true
type: string
python_version:
required: true
type: string

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ github.event.inputs.python_version }}

- name: Upgrade pip
run: py -m pip install --upgrade pip --user

- name: Install requirements
run: py -m pip install --no-deps -r ./requirements.txt

- name: Install geckodriver
shell: bash
run: choco install selenium-gecko-driver -y

- name: Install Firefox
shell: bash
run: choco install firefox-nightly --pre --ignore-checksums -y

- name: Install Setup Tools
run: pip install setuptools

- name: Run tests
timeout-minutes: 30
shell: bash
env:
MOZ_HEADLESS: 1
run: |
variables=""
for var in ${inputs.pytest_variables//,/ }; do
variables="$variables --variables $var"
done

py -m pytest ${{ inputs.pytest_path }} \
-n ${{ inputs.pytest_parallel }} \
-m ${{ inputs.pytest_marker }} \
--reruns ${{ inputs.pytest_reruns }} \
--driver Firefox \
$variables \
--html=${{ inputs.pytest_report }} \
--self-contained-html

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.pytest_report }}

17 changes: 17 additions & 0 deletions .github/workflows/addon_submissions_dev_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Addon Submissions Dev Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: submissions-dev-test-results.html
pytest_parallel: 1
pytest_path: tests/devhub_submissions/test_addon_submissions.py
pytest_report: submissions-dev-test-results.html
pytest_reruns: 2
pytest_variables: dev.json
python_version: 3.x
18 changes: 18 additions & 0 deletions .github/workflows/addon_submissions_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Addon Submissions Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
# TODO: install typeguard
with:
artifact_name: submissions-test-results
pytest_parallel: 1
pytest_path: tests/devhub_submissions/test_addon_submissions.py
pytest_report: submissions-test-results.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
17 changes: 17 additions & 0 deletions .github/workflows/api_submission_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: API Submission Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: api_submission_tests.html
pytest_parallel: 1
pytest_path: tests/api_w
pytest_report: api_submission_tests.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
17 changes: 17 additions & 0 deletions .github/workflows/collections_dev_serial_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Collections Dev Serial Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: collections-dev-test-results.html
pytest_parallel: 1
pytest_path: tests/frontend/test_collections.py
pytest_report: collections-dev-test-results.html
pytest_reruns: 2
pytest_variables: dev.json
python_version: 3.x
17 changes: 17 additions & 0 deletions .github/workflows/collections_serial_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Collections Serial Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: collections-test-results
pytest_parallel: 1
pytest_path: tests/frontend/test_collections.py
pytest_report: collections-test-results.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
31 changes: 31 additions & 0 deletions .github/workflows/commit_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Commit Workflow

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
frontend_parallel:
uses: ./.github/workflows/frontend_parallel_tests.yml

# user_serial:
# uses: ./.github/workflows/user_serial_tests.yml

# collections_serial:
# uses: ./.github/workflows/collections_serial_tests.yml

# ratings_serial:
# uses: ./.github/workflows/ratings_serial_tests.yml

# devhub_parallel:
# uses: ./.github/workflows/devhub_parallel_tests.yml

# addon_submissions:
# uses: ./.github/workflows/addon_submissions_tests.yml

# api_submission:
# uses: ./.github/workflows/api_submission_tests.yml
17 changes: 17 additions & 0 deletions .github/workflows/coverage_devhub_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Coverage DevHub Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: coverage-devhub-tests-results
pytest_parallel: 1
pytest_path: tests/coverage/test_coverage_devhub.py
pytest_report: coverage-devhub-tests-results.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
17 changes: 17 additions & 0 deletions .github/workflows/coverage_frontend_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Coverage Frontend Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: coverage-frontend-tests-results
pytest_parallel: 1
pytest_path: tests/coverage/test_coverage_frontend.py
pytest_report: coverage-frontend-tests-results.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
18 changes: 18 additions & 0 deletions .github/workflows/devhub_dev_parallel_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Devhub Dev Parallel Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: devhub-dev-parallel-test-results.html
pytest_marker: "not serial and not prod_only"
pytest_parallel: 4
pytest_path: tests/devhub
pytest_report: devhub-dev-parallel-test-results.html
pytest_reruns: 2
pytest_variables: dev.json
python_version: 3.x
18 changes: 18 additions & 0 deletions .github/workflows/devhub_parallel_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Devhub Parallel Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: devhub-parallel-test-results
pytest_marker: "not serial and not prod_only"
pytest_parallel: 4
pytest_path: tests/devhub
pytest_report: devhub-parallel-test-results.html
pytest_reruns: 2
pytest_variables: stage.json
python_version: 3.x
18 changes: 18 additions & 0 deletions .github/workflows/frontend_dev_parallel_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Frontend Dev Parallel Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: frontend-dev-parallel-test-results
pytest_marker: "not serial and not prod_only"
pytest_parallel: 4
pytest_path: tests/frontend
pytest_report: frontend-dev-parallel-test-results.html
pytest_reruns: 2
pytest_variables: dev.json,translations.json
python_version: 3.x
18 changes: 18 additions & 0 deletions .github/workflows/frontend_parallel_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Frontend Parallel Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: frontend-parallel-test-results
pytest_marker: "not serial and not prod_only"
pytest_parallel: 4
pytest_path: tests/frontend
pytest_report: frontend-parallel-test-results.html
pytest_reruns: 2
pytest_variables: stage.json,translations.json
python_version: 3.x
17 changes: 17 additions & 0 deletions .github/workflows/ratings_dev_serial_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Ratings Dev Serial Tests

on:
workflow_dispatch:
workflow_call:

jobs:
test:
uses: ./.github/workflows/_test.yml
with:
artifact_name: ratings-dev-test-results.html
pytest_parallel: 1
pytest_path: tests/frontend/test_ratings.py
pytest_report: ratings-dev-test-results.html
pytest_reruns: 2
pytest_variables: dev.json
python_version: 3.x
Loading