Merge pull request #193 from scipp/update_gh_actions #551
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
# SPDX-License-Identifier: BSD-3-Clause | |
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | |
name: PR and Main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} | |
cancel-in-progress: true # cancel jobs from previous push | |
defaults: | |
run: | |
shell: bash -l {0} # required for conda env | |
jobs: | |
formatting: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
- run: python -m pip install --upgrade pip | |
- run: python -m pip install -r requirements/ci.txt | |
- run: tox -e static | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply automatic formatting | |
tests: | |
needs: formatting | |
name: tests-${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-22.04", "macos-11", "windows-2019"] | |
env: | |
JUPYTER_PLATFORM_DIRS: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # history required so cmake can determine version | |
- name: Setup conda environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
cache-environment: true | |
- run: conda develop src | |
- run: python -m pytest -v tests | |
docs: | |
needs: tests | |
name: docs-${{ matrix.os }} | |
uses: ./.github/workflows/docs.yml | |
with: | |
publish: false | |
version: ${{ github.ref_name }} | |
branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }} | |
platform: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-22.04", "macos-11", "windows-2019"] |