-
-
Notifications
You must be signed in to change notification settings - Fork 20
142 lines (129 loc) · 4.61 KB
/
Copy pathmain.yaml
File metadata and controls
142 lines (129 loc) · 4.61 KB
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
133
134
135
136
137
138
139
140
141
142
name: main
on:
workflow_call:
inputs:
build-artifact-name:
required: true
type: string
build-artifact-path:
required: true
type: string
pyodide-version:
required: false
type: string
default: "0.29.3"
python-version:
required: false
type: string
default: "3.13"
os:
required: false
type: string
default: "ubuntu-latest"
runner:
required: false
type: string
default: "selenium"
browser:
required: false
type: string
default: "chrome"
browser-version:
required: false
type: string
default: "latest"
playwright-version:
required: false
type: string
default: "" # latest
pytest-extra-args:
required: false
type: string
default: ""
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ inputs.os }}-${{ inputs.runner }}-${{ inputs.browser }}-${{ inputs.browser-version }}-${{ inputs.pyodide-version }}-${{ inputs.playwright-version }}
cancel-in-progress: true
jobs:
test:
name: test (${{ inputs.pyodide-version}},${{ inputs.browser }},${{ inputs.runner }})
runs-on: ${{ inputs.os }}
env:
DISPLAY: :99
FORCE_COLOR: 3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
if: ${{ contains(inputs.browser, 'node') || inputs.runner == 'playwright' }}
with:
node-version: ${{ inputs.browser-version }}
- name: Cache Playwright browsers
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: ${{ inputs.runner == 'playwright' }}
with:
path: .cache/ms-playwright
key: ${{ runner.os }}-playwright-latest
- name: Install playwright
if: ${{ inputs.runner == 'playwright' }}
run: |
if [ -n "${{ inputs.playwright-version }}" ]
then
python -m pip install playwright==${{inputs.playwright-version}}
else
python -m pip install playwright
fi
# TODO: install only browsers that are required
python -m playwright install --with-deps
- uses: pyodide/pyodide-actions/download-pyodide@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
version: ${{ inputs.pyodide-version }}
to: pyodide-dist
- uses: pyodide/pyodide-actions/install-browser@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
runner: ${{ inputs.runner }}
browser: ${{ inputs.browser }}
browser-version: ${{ inputs.browser-version }}
playwright-version: ${{ inputs.playwright-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download build artifacts from calling package
if: ${{ inputs.build-artifact-name != 'none' }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.build-artifact-name }}
path: ${{ inputs.build-artifact-path }}
merge-multiple: true
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ inputs.python-version }}
- name: install pyodide-py
run: |
python -m pip install pyodide-py==${{inputs.pyodide-version}}
- name: Install pytest-pyodide
run: |
if [ -d "pytest_pyodide" ]; then
# Currently we only install the package for dependencies.
# We then uninstall it otherwise tests fails due to pytest hook being
# registered twice.
python -m pip install ".[test]"
else
python -m pip install pytest-pyodide
fi
- name: Run tests
run: |
python -m pytest -vra \
--cov=pytest_pyodide \
--dist-dir=./pyodide-dist/ \
--runner=${{ inputs.runner }} \
--rt=${{ inputs.browser }} \
${{ inputs.pytest-extra-args }}
- name: Check for coverage file
id: check_coverage
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: "coverage.xml"
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
if: ${{ steps.check_coverage.outputs.files_exists }}
with:
fail_ci_if_error: false