Skip to content

Commit

Permalink
update workflow to use cache (#569)
Browse files Browse the repository at this point in the history
* update woorkflow

* Update pytest.yaml

* rename
  • Loading branch information
PythonFZ authored Apr 5, 2023
1 parent 0717a38 commit 7a0e6e4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 50 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/lint.yaml

This file was deleted.

68 changes: 46 additions & 22 deletions .github/workflows/pytest.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: pytest
name: tests

on:
push:
Expand All @@ -11,13 +11,36 @@ on:
- cron: '14 3 * * 1' # at 03:14 on Monday.

jobs:
test:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Poetry
run: |
pipx install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
cache: 'poetry'
- name: Install lint tools
run: |
poetry install --no-root --only=lint
- name: black
if: always()
run: poetry run black --check .
- name: ruff
if: always()
run: poetry run ruff .

pytest:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.10"
- 3.9
- 3.8
Expand All @@ -26,14 +49,14 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install Poetry
run: |
pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.2.2
cache: 'poetry'
- name: Install package
run: |
poetry install --no-interaction
Expand All @@ -60,19 +83,20 @@ jobs:

nbtest:
runs-on: ubuntu-latest

needs: [ pytest ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Poetry
uses: abatilo/actions-poetry@v2
run: |
pipx install poetry
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
poetry-version: 1.2.2
python-version: "3.9"
cache: 'poetry'
- name: Install package
run: |
poetry install --no-interaction
poetry install
- name: Setup git user
run: |
git config --global user.name "John Doe"
Expand All @@ -84,22 +108,22 @@ jobs:
doctest:
runs-on: ubuntu-latest

needs: [ pytest, nbtest, lint ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install Poetry
uses: abatilo/actions-poetry@v2
run: |
pipx install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
poetry-version: 1.2.2
python-version: "3.11"
cache: 'poetry'
- name: Install package
run: |
sudo apt install pandoc
poetry config virtualenvs.create false
poetry install --with=docs
- name: Build documentation
run: |
cd ./docs
make html
poetry run make html

0 comments on commit 7a0e6e4

Please sign in to comment.