Skip to content

Commit

Permalink
Update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 committed Jun 11, 2024
1 parent 7e98e58 commit bb275a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 45 deletions.
54 changes: 11 additions & 43 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,52 +41,21 @@ permissions:
contents: read

jobs:
# separate job needed to setup the correct version of python and github os for pyodide version
get_versions:
runs-on: ubuntu-latest
name: Set python/os version (${{inputs.pyodide-version}},${{inputs.os}})
outputs:
os: ${{ steps.fix_runner_os.outputs.os }}
python: ${{ steps.get_python_version.outputs.python }}
pythonexec: ${{ steps.get_python_version.outputs.pythonexec }}
steps:
- name: Get python version for a particular pyodide version
id: get_python_version
run: |
case "${{inputs.pyodide-version}}" in
*)
echo "python=3.10.2" >> $GITHUB_OUTPUT
echo "pythonexec=python310" >> $GITHUB_OUTPUT
echo "Using python 3.10.2 for pyodide ${{inputs.pyodide-version}}"
;;
esac
- name: Fix runner os
id: fix_runner_os
run: |
if [[ "${{ steps.get_python_version.outputs.python }}" == "3.10.2" && "${{inputs.os}}" == ubuntu* && "${{inputs.os}}" != ubuntu-20.04 ]]
then
echo "Fixing ubuntu version ${{ inputs.os }} to ubuntu-20.04 for python 3.10.2"
echo "os=ubuntu-20.04" >> $GITHUB_OUTPUT
else
echo "Using existing OS: ${{inputs.os}} for python ${{ steps.get_python_version.outputs.python }}"
echo "os=${{inputs.os}}" >> $GITHUB_OUTPUT
fi
test:
name: test ${{ inputs.browser }} ( ${{ inputs.runner }},${{ needs.get_versions.outputs.os }},pyodide:${{ inputs.pyodide-version}})
needs: get_versions
runs-on: ${{ needs.get_versions.outputs.os }}
name: test ${{ inputs.browser }} (${{ inputs.runner }}, pyodide:${{ inputs.pyodide-version}})
runs-on: ubuntu-latest
env:
DISPLAY: :99
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ needs.get_versions.outputs.python }}
python-version: 3.12
- name: Install node
uses: actions/setup-node@v3
if: ${{ contains(inputs.browser, 'node') || inputs.runner == 'playwright' }}
with:
node-version: ${{ inputs.node-version }}
node-version: ${{ inputs.browser-version }}

- name: Cache Playwright browsers
uses: actions/cache@v3
Expand All @@ -101,12 +70,12 @@ jobs:
run: |
if [ -n "${{ inputs.playwright-version }}" ]
then
${{needs.get_versions.outputs.pythonexec}} -m pip install playwright==${{inputs.playwright-version}}
python -m pip install playwright==${{inputs.playwright-version}}
else
${{needs.get_versions.outputs.pythonexec}} -m pip install playwright
python -m pip install playwright
fi
# TODO: install only browsers that are required
${{needs.get_versions.outputs.pythonexec}} -m playwright install --with-deps
python -m playwright install --with-deps
- uses: pyodide/pyodide-actions/download-pyodide@v1
with:
Expand All @@ -118,7 +87,7 @@ jobs:
runner: ${{ inputs.runner }}
browser: ${{ inputs.browser }}
browser-version: ${{ inputs.browser-version }}
playwright-version: ${{ inputs.runner-version }}
playwright-version: ${{ inputs.playwright-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download build artifacts from calling package
Expand All @@ -131,7 +100,7 @@ jobs:
- name: install pyodide-py
shell: bash -l {0}
run: |
${{needs.get_versions.outputs.pythonexec}} -m pip install pyodide-py==${{inputs.pyodide-version}}
python -m pip install pyodide-py==${{inputs.pyodide-version}}
- name: Install pytest-pyodide
Expand All @@ -141,10 +110,9 @@ jobs:
# Currently we only install the package for dependencies.
# We then uninstall it otherwise tests fails due to pytest hook being
# registered twice.
# temporarily pin pytest version (https://github.com/pyodide/pytest-pyodide/pull/133#issuecomment-2081412407)
${{needs.get_versions.outputs.pythonexec}} -m pip install ".[test]" "pytest<8.0.0"
python -m pip install ".[test]"
else
${{needs.get_versions.outputs.pythonexec}} -m pip install pytest-pyodide
python -m pip install pytest-pyodide
fi
- name: Run tests
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ on:
required: false
type: string
default: ""
playwright-version:
playwright-versions:
required: false
type: string
default: "" # latest
Expand Down
2 changes: 1 addition & 1 deletion utils/build_test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import itertools
import json

DEFAULT_OS = "ubuntu-20.04, macos-11"
DEFAULT_OS = "ubuntu-latest, macos-latest"
DEFAULT_RUNNER = "selenium, playwright"
DEFAULT_BROWSER = "chrome, firefox, node, safari, host"
DEFAULT_CHROME_VERSION = "latest"
Expand Down

0 comments on commit bb275a1

Please sign in to comment.