Skip to content

Support extracting minimum constraints for monorepo #693

Support extracting minimum constraints for monorepo

Support extracting minimum constraints for monorepo #693

Workflow file for this run

name: Tests
on:
push:
branches: ["main"]
pull_request:
defaults:
run:
shell: bash -eux {0}
jobs:
base_setup:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.11"]
include:
- os: ubuntu-latest
python-version: "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
with:
node_version: 18.0
- name: Check Hatch Version
run: hatch --version
base_setup_minimum:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
with:
dependency_type: minimum
- run: |
pip install -e ".[test]"
# NOTE: keep the python version in sync with README
python --version
python --version | grep "3.8"
hatch run check_minimum
base_setup_pre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
with:
dependency_type: pre
- run: |
pip install -e ".[test]"
# NOTE: keep this version in sync with README
python --version
python --version | grep "3.12"
hatch run check_pre
test_lint:
name: Test Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:build
pipx run interrogate -v .
check_links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
- uses: ./.github/actions/check-links
downstream_defaults:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock python package
run: echo "from setuptools import setup; setup(name='foo')" > setup.py
- name: Check Downstream test with defaults
uses: ./.github/actions/downstream-test
with:
package_name: jupyter_core
downstream_overrides:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock python package
run: echo "from setuptools import setup; setup(name='foo')" > setup.py
- name: Check Downstream test with overrides
uses: ./.github/actions/downstream-test
with:
package_name: nbclient
package_spec: "nbclient[test] ipykernel"
package_download_extra_args: "--use-pep517"
test_command: "echo 'hello'"
extra_test: "pytest"
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\>
binder_link:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Check Binder Link
uses: ./.github/actions/binder-link
with:
github_token: "FAKE"
url_path: "/foo/bar"
pr_script:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Check PR Script All Options
uses: ./.github/actions/pr-script
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
script: '["jlpm run integrity", "jlpm run lint"]'
commit_message: "auto run cleanup"
target: "https://github.com/jupyterlab/maintainer-tools/pull/39"
association: "MEMBER"
git_username: "snuffy-bot"
git_email: "[email protected]"
- name: Check PR Script Defaults
uses: ./.github/actions/pr-script
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
pre_commit: true
target: "https://github.com/jupyterlab/maintainer-tools/pull/39"
update_snapshots-manual-server:
runs-on: ubuntu-latest
env:
TEST_FOLDER: mock-playwright
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock playwright test package
shell: bash
run: |
mkdir -p ${TEST_FOLDER}/tests/example.spec.ts-snapshots
pushd ${TEST_FOLDER}
# Prevent yarn to look up in the folder hierarchy
touch yarn.lock
yarn init -yp
yarn add -D @playwright/test
cat package.json | jq '. += {"scripts": {"start": "echo starting...", "test:update": "yarn playwright test -u"}}' > new_package.json
cat > tests/example.spec.ts << EOF
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
await page.locator('text=Get started').click();
await expect(page).toHaveTitle(/Installation | Playwright/);
});
EOF
cp new_package.json package.json
# Create fake snapshot
touch tests/example.spec.ts-snapshots/dummy.txt
git checkout -b test-snapshot
popd
- name: Check update snapshots action
uses: ./.github/actions/update-snapshots
with:
github_token: "FAKE"
test_folder: ${{ env.TEST_FOLDER }}
server_url: https-get://playwright.dev
dry_run: yes
artifact_name: playwright-manual-snapshots
update_snapshots:
runs-on: ubuntu-latest
env:
TEST_FOLDER: mock-playwright
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock playwright test package
shell: bash
run: |
mkdir -p ${TEST_FOLDER}/tests/example.spec.ts-snapshots
pushd ${TEST_FOLDER}
# Prevent yarn to look up in the folder hierarchy
touch yarn.lock
yarn init -yp
yarn add -D @playwright/test
cat package.json | jq '. += {"scripts": {"test:update": "yarn playwright test -u"}}' > new_package.json
cat > tests/example.spec.ts << EOF
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
await page.locator('text=Get started').click();
await expect(page).toHaveTitle(/Installation | Playwright/);
});
EOF
cp new_package.json package.json
# Create fake snapshot
touch tests/example.spec.ts-snapshots/dummy.txt
git checkout -b test-snapshot
popd
- name: Check update snapshots action
uses: ./.github/actions/update-snapshots
with:
github_token: "FAKE"
test_folder: ${{ env.TEST_FOLDER }}
start_server_script: "null"
dry_run: yes
make_sdist:
name: Make SDist
runs-on: windows-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
- uses: ./.github/actions/make-sdist
test_sdist:
runs-on: macos-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
- uses: ./.github/actions/test-sdist
coverage_test:
name: Test coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
- run: |
pip install coverage[toml] pytest
python -m coverage run -m pytest foobar.py
ls -a
- uses: ./.github/actions/upload-coverage
with:
artifact_name: coverage-data-${{ matrix.os }}
coverage_report:
name: Combine & check coverage
needs: coverage_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/report-coverage
tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- base_setup
- base_setup_minimum
- base_setup_pre
- test_lint
- check_links
- binder_link
- pr_script
- downstream_defaults
- downstream_overrides
- update_snapshots-manual-server
- update_snapshots
- test_sdist
- coverage_report
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}