Make resolvelib and unearth optional optional dependencies #1012
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_COLOR: 3 | |
| # Increase this value to reset cache if emscripten_version has not changed | |
| EMSDK_CACHE_FOLDER: "emsdk-cache" | |
| EMSDK_CACHE_NUMBER: 0 | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| # include tags so that hatch-vcs can infer the version | |
| fetch-depth: 0 | |
| # switch to fetch-tags: true when the following is fixed | |
| # see https://github.com/actions/checkout/issues/2041 | |
| # fetch-tags: true | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: "3.12" # TODO: update to 3.13 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test,resolve]" | |
| - name: Run tests | |
| run: | | |
| pytest \ | |
| --junitxml=test-results/junit.xml \ | |
| --cov=pyodide-build \ | |
| pyodide_build \ | |
| -m "not integration" | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: coverage-no-integration-${{ matrix.os }} | |
| path: .coverage | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - 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, or | |
| # if the PR has the "integration" label. | |
| if [[ "$GITHUB_EVENT_NAME" == push && "$GITHUB_REF" == refs/heads/main || | |
| "$COMMIT_MSG" =~ \[integration\] || | |
| "${{ contains(github.event.pull_request.labels.*.name, 'integration') }}" == "true" ]]; then | |
| echo "trigger=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| integration-test: | |
| name: integration-test (${{ matrix.task.name }}, ${{ matrix.task.installer }}, ${{ matrix.pyodide-version }}-pyodide, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| needs: [check-integration-test-trigger] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| task: [ | |
| { name: test-recipe, installer: pip }, | |
| { name: test-src, installer: pip }, | |
| { name: test-recipe, installer: uv }, | |
| { name: test-src, installer: uv }, | |
| { name: test-scripts, installer: pip }, | |
| { name: test-scripts, installer: uv }, | |
| { name: test-integration-marker, installer: pip }, # installer doesn't matter | |
| ] | |
| # os: [ubuntu-latest, macos-latest] # FIXME: https://github.com/oracle/graal/issues/11855 | |
| os: [ubuntu-latest] | |
| pyodide-version: [stable] | |
| include: | |
| # Run no-isolation tests and Pyodide minimum version testing only | |
| # for the pip installer and on Linux | |
| - task: {name: test-src-no-isolation, installer: pip} # installer doesn't matter | |
| os: ubuntu-latest | |
| - task: { name: test-recipe, installer: pip } | |
| os: ubuntu-latest | |
| pyodide-version: minimum | |
| - task: { name: test-src, installer: pip } | |
| os: ubuntu-latest | |
| pyodide-version: minimum | |
| if: needs.check-integration-test-trigger.outputs.run-integration-test | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| # include tags so that hatch-vcs can infer the version | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: "3.13" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version: "24" | |
| - name: Install the package | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ."[test,uv]" | |
| - name: Install xbuildenv | |
| run: | | |
| if [[ "${{ matrix.pyodide-version }}" == "minimum" ]]; then | |
| MIN_VERSION=$(pyodide xbuildenv search --json | jq -r '.environments | sort_by(.version) | .[0].version') | |
| echo "Installing Pyodide xbuildenv version: $MIN_VERSION" | |
| pyodide xbuildenv install $MIN_VERSION | |
| else | |
| pyodide xbuildenv install | |
| fi | |
| echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV | |
| - name: Install Emscripten | |
| run: pyodide xbuildenv install-emscripten | |
| - name: Get number of cores on the runner | |
| id: get-cores | |
| run: echo "CORES=$(nproc)" >> $GITHUB_OUTPUT | |
| - name: Run tests marked with integration | |
| if: matrix.task.name == 'test-integration-marker' | |
| run: | | |
| source $(pyodide config get pyodide_root)/../../emsdk/emsdk_env.sh | |
| pytest --junitxml=test-results/junit.xml --cov=pyodide-build pyodide_build -m "integration" | |
| - name: Run the recipe integration tests (${{ matrix.task.name }}) | |
| if: matrix.task.name != 'test-integration-marker' | |
| env: | |
| PYODIDE_JOBS: ${{ steps.get-cores.outputs.CORES }} | |
| working-directory: integration_tests | |
| run: | | |
| source $(pyodide config get pyodide_root)/../../emsdk/emsdk_env.sh | |
| # https://github.com/pyodide/pyodide-build/issues/147 | |
| # disable package with scikit-build-core | |
| if [[ ${{ matrix.os }} == "macos-latest" ]]; then | |
| export RECIPE_BUILD_TARGET="*,!boost-histogram" | |
| fi | |
| if [[ "${{ matrix.task.installer }}" == "uv" ]]; then | |
| export UV_RUN_PREFIX="uv run" | |
| fi | |
| make ${{ matrix.task.name }} | |
| - name: Upload coverage for tests marked with integration | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| if: matrix.task.name == 'test-integration-marker' | |
| with: | |
| name: coverage-from-integration-${{ matrix.os }} | |
| path: .coverage | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| coverage: | |
| name: Collect and upload coverage | |
| runs-on: ubuntu-latest | |
| needs: [test, integration-test] | |
| steps: | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: coverage_files | |
| pattern: coverage-* | |
| merge-multiple: false | |
| - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Combine coverage files | |
| run: pipx install coverage && coverage combine --append coverage_files/**/.coverage | |
| - uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| fail_ci_if_error: false | |
| files: .coverage |