[pre-commit.ci] pre-commit autoupdate (#204) #552
This file contains 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: 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@v3 | |
- name: Base Setup | |
uses: ./.github/actions/base-setup | |
with: | |
node_version: 15.0 | |
- name: Check Hatch Version | |
run: hatch --version | |
base_setup_minimum: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
- 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.11" | |
hatch run check_pre | |
test_lint: | |
name: Test Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Run Linters | |
run: | | |
hatch run typing:test | |
hatch run lint:style | |
pipx run interrogate -v . | |
check_links: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/base-setup | |
- uses: ./.github/actions/check-links | |
downstream_defaults: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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@v3 | |
- 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 --pyargs nbclient" | |
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\> | |
binder_link: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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@v3 | |
- 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" | |
install_minimums: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8"] # Test against minimum Python version as well | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Base Setup | |
uses: ./.github/actions/base-setup | |
- name: Clone a repo | |
run: git clone --depth=1 https://github.com/jupyter/nbformat.git | |
- name: Install minimum versions | |
uses: ./.github/actions/install-minimums | |
with: | |
working-directory: nbformat | |
- name: Run the unit tests | |
working-directory: nbformat | |
run: pytest -vv | |
- name: Only create file | |
uses: ./.github/actions/install-minimums | |
with: | |
only_create_file: 1 | |
constraints_file_path: './constraints-test.txt' | |
- name: Ensure constraints file | |
run: | | |
cat ./constraints-test.txt | |
echo $PIP_CONSTRAINT | grep "constraints-test.txt" | |
update_snapshots-manual-server: | |
runs-on: ubuntu-latest | |
env: | |
TEST_FOLDER: mock-playwright | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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} | |
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 | |
update_snapshots: | |
runs-on: ubuntu-latest | |
env: | |
TEST_FOLDER: mock-playwright | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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} | |
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@v3 | |
- 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@v3 | |
- 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@v3 | |
- 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 | |
coverage_report: | |
name: Combine & check coverage | |
needs: coverage_test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/report-coverage | |
tests_check: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: | |
- base_setup | |
- test_lint | |
- check_links | |
- binder_link | |
- pr_script | |
- install_minimums | |
- 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) }} |