-
-
Notifications
You must be signed in to change notification settings - Fork 28
131 lines (111 loc) · 4.52 KB
/
main.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
129
130
131
name: main
on: [push, pull_request]
permissions:
contents: read
concurrency:
group: main-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
test:
runs-on: ${{ matrix.os }}
needs: [check-integration-test-trigger]
env:
DISPLAY: :99
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
pyodide-version: ["0.27.a2"]
test-config: [
# FIXME: recent version of chrome gets timeout
{ runner: selenium, runtime: chrome, runtime-version: "125" },
{ runner: selenium, runtime: node, runtime-version: "22" },
]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# with:
# submodules: recursive
with:
ref: v0.8.0
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: 3.12
- uses: pyodide/pyodide-actions/download-pyodide@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
version: ${{ matrix.pyodide-version }}
to: dist
- uses: pyodide/pyodide-actions/install-browser@012fa537869d343726d01863a34b773fc4d96a14 # v2
with:
runner: ${{ matrix.test-config.runner }}
browser: ${{ matrix.test-config.runtime }}
browser-version: ${{ matrix.test-config.runtime-version }}
- name: Install requirements
shell: bash -l {0}
run: |
python3 -m pip install -e .[test]
- name: Add this test to the end of the test_install.py file
shell: bash -l {0}
run: |
echo "def test_freeze_after_install_without_deps(selenium_standalone_micropip, wheel_catalog):" >> tests/test_install.py
echo " selenium = selenium_standalone_micropip" >> tests/test_install.py
echo " shapely = wheel_catalog.get(\"shapely\")" >> tests/test_install.py
echo "" >> tests/test_install.py
echo " selenium.run_js(" >> tests/test_install.py
echo " f\"\"\"" >> tests/test_install.py
echo " await pyodide.runPythonAsync(`" >> tests/test_install.py
echo " import micropip" >> tests/test_install.py
echo " await micropip.install(\"{shapely.url}\", deps=False)" >> tests/test_install.py
echo " micropip.freeze()" >> tests/test_install.py
echo " `);" >> tests/test_install.py
echo " \"\"\"" >> tests/test_install.py
echo " )" >> tests/test_install.py
- name: Run tests
shell: bash -l {0}
run: |
pytest -v tests \
--cov=micropip \
--durations=10 \
--dist-dir=./dist/ \
--maxfail=15 \
--runner=${{ matrix.test-config.runner }} \
--rt ${{ matrix.test-config.runtime }}
- name: Run integration tests
if: needs.check-integration-test-trigger.outputs.run-integration-test
shell: bash -l {0}
run: |
pytest -v tests/integration \
--integration \
--cov=micropip \
--durations=10 \
--dist-dir=./dist/ \
--maxfail=15 \
--runner=${{ matrix.test-config.runner }} \
--rt ${{ matrix.test-config.runtime }}
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
if: ${{ github.event.repo.name == 'pyodide/micropip' || github.event_name == 'pull_request' }}
with:
fail_ci_if_error: false
check-integration-test-trigger:
name: test-integration-test-trigger
runs-on: ubuntu-latest
outputs:
run-integration-test: ${{ steps.check-integration-test-trigger.outputs.trigger }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- id: check-integration-test-trigger
name: Check integration test trigger
shell: bash
run: |
set -e -x
COMMIT_MSG=$(git log --no-merges -1 --oneline)
# The integration tests will be triggered on push or on pull_request when the commit
# message contains "[integration]" or if it is pushed to main branch.
if [[ "$GITHUB_EVENT_NAME" == push && "$GITHUB_REF" == refs/heads/main ||
"$COMMIT_MSG" =~ \[integration\] ]]; then
echo "trigger=true" >> "$GITHUB_OUTPUT"
fi