Skip to content

Add example using xarray atmospheric data #23

Add example using xarray atmospheric data

Add example using xarray atmospheric data #23

# Our minimal suite of tests that run on each pull request
name: PR Test
on:
pull_request:
branches:
- main
- "v*x"
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
COLUMNS: 120
jobs:
import_lint:
name: Import lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install --upgrade pip
pip install tox
- name: Run import lint
run: tox -e import-lint
manifest:
# make sure all necessary files will be bundled in the release
name: Check Manifest
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache-dependency-path: pyproject.toml
cache: 'pip'
- name: Install Dependencies
run: pip install --upgrade pip
- name: Install Napari dev
run: pip install -e .[build]
env:
PIP_CONSTRAINT: resources/constraints/constraints_py3.11.txt
- name: Make Typestubs
run: |
make typestubs
- name: Check Manifest
run: |
make check-manifest
localization_syntax:
# make sure all necessary files will be bundled in the release
name: Check l18n syntax
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Check localization formatting
run: |
pip install --upgrade pip semgrep
# f"..." and f'...' are the same for semgrep
semgrep --error --lang python --pattern 'trans._(f"...")' napari
semgrep --error --lang python --pattern "trans._(\$X.format(...))" napari
build_wheel:
name: Build wheel
uses: ./.github/workflows/reusable_build_wheel.yml
test_initial:
name: Initial test
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: build_wheel
strategy:
fail-fast: false
matrix:
include:
- python: 3.9
platform: ubuntu-latest
backend: pyqt5
pydantic: "_pydantic_1"
coverage: no_cov
min_req: ""
- python: 3.12
platform: ubuntu-latest
backend: pyqt6
pydantic: ""
coverage: no_cov
min_req: ""
with:
python_version: ${{ matrix.python }}
platform: ${{ matrix.platform }}
qt_backend: ${{ matrix.backend }}
coverage: ${{ matrix.coverage }}
min_req: ${{ matrix.MIN_REQ }}
constraints_suffix: ${{ matrix.pydantic }}
test:
name: ${{ matrix.platform }}
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: test_initial
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest ]
python: [ "3.10", "3.11" ]
backend: [ "pyqt5,pyside6" ]
coverage: [ cov ]
pydantic: ["_pydantic_1"]
include:
# Windows py310
- python: "3.10"
platform: windows-latest
backend: pyqt5 #,pyside2
coverage: no_cov
- python: "3.12"
platform: windows-latest
backend: pyqt6
coverage: cov
- python: "3.12"
platform: macos-13
backend: pyqt5
coverage: no_cov
- python: "3.12"
platform: macos-latest
backend: pyqt5
coverage: no_cov
# minimum specified requirements
- python: "3.9"
platform: ubuntu-20.04
backend: pyqt5
MIN_REQ: 1
coverage: cov
- python: "3.11"
platform: ubuntu-22.04
backend: pyqt5
coverage: cov
pydantic: ""
tox_extras: "optional"
# test without any Qt backends
- python: "3.10"
platform: ubuntu-20.04
backend: headless
coverage: no_cov
- python: "3.12"
platform: ubuntu-latest
backend: pyqt6
coverage: cov
tox_extras: "testing_extra"
# pyside2 test
- python: "3.10"
platform: ubuntu-latest
backend: pyside2
coverage: no_cov
with:
python_version: ${{ matrix.python }}
platform: ${{ matrix.platform }}
qt_backend: ${{ matrix.backend }}
min_req: ${{ matrix.MIN_REQ }}
coverage: ${{ matrix.coverage }}
tox_extras: ${{ matrix.tox_extras }}
constraints_suffix: ${{ matrix.pydantic }}
test_pip_install:
needs: test_initial
name: pip install
uses: ./.github/workflows/reusable_pip_test.yml
test_examples:
name: test examples
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: test_initial
with:
toxenv: py39-linux-pyside2-examples-cov
timeout: 60
python_version: 3.9
constraints_suffix: _examples
coverage: cov
coverage_report:
if: ${{ always() }}
needs:
- test
- test_examples
uses: ./.github/workflows/reusable_coverage_upload.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
test_benchmarks:
name: test benchmarks
runs-on: ubuntu-latest
needs: test_initial
timeout-minutes: 60
env:
GIT_LFS_SKIP_SMUDGE: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: pyproject.toml
- uses: tlambert03/setup-qt-libs@v1
- uses: octokit/[email protected]
# here we get hash of the latest release commit to compare with PR
id: latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: napari
repo: napari
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: install dependencies
run: |
pip install --upgrade pip
pip install "asv[virtualenv]"
env:
PIP_CONSTRAINT: resources/constraints/benchmark.txt
- name: asv machine
run: asv machine --yes
- name: Run benchmarks PR
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 HEAD^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/resources/constraints/benchmark.txt
- name: Run benchmarks latest release
# here we check if the benchmark on the latest release is not broken
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 ${{ fromJSON(steps.latest_release.outputs.data).target_commitish }}^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/resources/constraints/benchmark.txt