Merge pull request #317 from snek5000/pre-commit-ci-update-config #368
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: build | |
on: | |
push: | |
branches: [ main ] | |
# tags: ['*'] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: | |
- published | |
env: | |
FORCE_COLOR: 1 | |
NEK_SOURCE_ROOT: /home/runner/Nek5000 | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Clone Nek5000 | |
run: git clone --depth=1 https://github.com/snek5000/Nek5000.git $HOME/Nek5000 | |
- name: Install apt packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install gfortran libopenmpi-dev | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "requirements/tests.txt" | |
- name: Verify Python environment | |
run: | | |
pip list | |
pip cache list | |
pip check | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip nox | |
- name: Run tests | |
run: | | |
nox --session tests-cov -- -v --runslow --cov-report=xml | |
- name: Upload coverage to codecov | |
if: ${{ success() }} | |
uses: codecov/codecov-action@v2 | |
deploy: | |
needs: [tests, docs] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip nox | |
- name: Package | |
run: nox --session release-build | |
- name: Publish package | |
if: | | |
( | |
( github.event_name == 'release' && github.event.action == 'published' ) || | |
( github.event_name == 'push' && startsWith(github.ref, 'refs/tags') ) | |
) | |
env: | |
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: nox --session release-upload -- --repository testpypi | |
docs: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Clone Nek5000 | |
run: git clone --depth=1 https://github.com/snek5000/Nek5000.git $HOME/Nek5000 | |
- name: Install apt packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install gfortran libopenmpi-dev | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: "pip" | |
cache-dependency-path: "requirements/docs.txt" | |
- name: Verify Python environment | |
run: | | |
pip list | |
pip cache list | |
pip check | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip nox | |
- name: Build docs | |
run: | | |
nox --session docs -- -W |