feat/parallelisation #1068
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: Unit tests and docs generation | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
jobs: | |
check: | |
if: github.event.pull_request.draft == false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Set OS and Python version | |
id: set-vars | |
run: | | |
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/dev" ]]; then | |
echo "os-matrix=ubuntu-latest,windows-latest" >> $GITHUB_ENV | |
echo "python-matrix=3.8,3.9,3.10,3.11" >> $GITHUB_ENV | |
else | |
echo "os-matrix=ubuntu-latest" >> $GITHUB_ENV | |
echo "python-matrix=3.11" >> $GITHUB_ENV | |
fi | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Poetry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pypoetry | |
~/.cache/pip | |
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry-${{ matrix.python-version }}- | |
- name: Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.3 | |
- name: Lock | |
run: poetry lock --no-update | |
- name: Install | |
run: poetry install | |
- name: Checkers | |
run: make checkers | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
docs: | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Poetry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pypoetry | |
~/.cache/pip | |
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry-${{ matrix.python-version }}- | |
- name: Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.3 | |
- name: Lock | |
run: poetry lock --no-update | |
- name: Install | |
run: poetry install | |
- name: Check Changed Files | |
id: changed-files | |
run: | | |
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} --depth=1 | |
git diff --name-only ${{ github.base_ref }} > changed_files.txt | |
- name: Build Docs | |
if: contains(fromJSON('["docs/", ".rst"]').join(','), fromJSON('["${{ steps.changed-files.outputs.files }}"]').join(',')) | |
run: | | |
poetry run sphinx-build -b html docs/ _build/html |