pyodide/.github/workflows/main.yml

221 lines
5.5 KiB
YAML

name: main
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: main-${{ github.head_ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.10"
- uses: pre-commit/action@v2.0.3
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install requirements
shell: bash -l {0}
run: |
pip install -r requirements.txt -r docs/requirements-doc.txt
- name: Run tests
shell: bash -l {0}
run: |
mkdir -p test-results
pytest docs/sphinx_pyodide/tests --junitxml=test-results/junit.xml
- name: Test Summary
uses: test-summary/action@v1
with:
paths: "test-results/*.xml"
if: always()
test-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install requirements
shell: bash -l {0}
run: |
mkdir test-results
cd pyodide-build && python3 -m pip install -e ".[test]" && cd ..
python3 -m pip install pytest-cov hypothesis pytz
- name: Run tests
shell: bash -l {0}
run: |
PYODIDE_ROOT=. pytest \
--junitxml=test-results/junit.xml \
--verbose \
--runtime=host \
--cov=pyodide_build --cov=pyodide \
src pyodide-build packages/micropip/ packages/_tests
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
build-core:
runs-on: ubuntu-latest
env:
EMSDK_NUM_CORES: 3
EMCC_CORES: 3
PYODIDE_JOBS: 3
CCACHE_DIR: /tmp/ccache
steps:
- uses: actions/checkout@v2
- name: Cache ccache output
uses: actions/cache@v2
with:
path: |
/tmp/ccache
key: ${{ hashFiles('Makefile.envs') }}-v20211025-
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pyodide-env
python-version: 3.10.2
channels: conda-forge
- name: Check Python versions
shell: bash -l {0}
run: |
python --version
which python
- name: Install dependencies
shell: bash -l {0}
run: |
sudo apt install -y build-essential git
conda install -y nodejs ccache f2c pkg-config swig make patch pkg-config texinfo autoconf automake libtool
pip install -r requirements.txt
- name: Build emsdk
shell: bash -l {0}
run: |
which ccache
ccache -z
make -C emsdk
ccache -s
- name: Build Cpython
shell: bash -l {0}
run: |
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
which ccache
ccache -z
make -C cpython
ccache -s
- name: build Pyodide core + numpy
shell: bash -l {0}
run: |
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
ccache -z
PYODIDE_PACKAGES="core,numpy" make
ccache -s
- name: check-size
run: ls -lh dist/
- name: Store artifacts build
uses: actions/upload-artifact@v2
with:
name: core-build
path: ./dist/
retention-days: 60
test-core:
runs-on: ubuntu-latest
env:
DISPLAY: :99
needs: [build-core]
strategy:
fail-fast: false
matrix:
runner: [playwright]
browser: [firefox, chrome]
steps:
- uses: actions/checkout@v2
- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: core-build
path: ./dist/
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pyodide-env
python-version: 3.10.2
channels: conda-forge
- name: install test requirements
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -e ./pyodide-build
# FIXME: playwright 1.23.0 has unknown performance issue on firefox
pip install "playwright<1.23.0" && python -m playwright install
- name: run core tests
env:
BROWSER: ${{ matrix.browser }}
RUNNER: ${{ matrix.runner }}
shell: bash -l {0}
run: |
ls -lh
ls -lh dist/
tools/pytest_wrapper.py src packages/micropip/ \
-v \
--runtime="${BROWSER}-no-host" \
--runner "${RUNNER}" \
--durations 50 \
--junitxml=test-results/core_test.xml
- name: run package tests
env:
BROWSER: ${{ matrix.browser }}
RUNNER: ${{ matrix.runner }}
shell: bash -l {0}
run: |
ls -lh
ls -lh dist/
tools/pytest_wrapper.py packages/*/test* \
-v \
-k "numpy and not joblib" \
--runtime="${BROWSER}-no-host" \
--runner "${RUNNER}" \
--durations 50 \
--junitxml=test-results/packages_test.xml
- name: Test Summary
uses: test-summary/action@v1
with:
paths: "test-results/*.xml"
if: always()