Merge pull request #2 from INRIM/v1.0.0rc #8
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
env: | |
POETRY_VERSION: 1.8.3 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
os: [ubuntu-latest, macOS-latest] | |
env: | |
POETRY_VIRTUALENVS_IN_PROJECT: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow | |
# from installing Poetry every time, which can be slow. Note the use of the Poetry version | |
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache | |
# manually if/when you want to upgrade Poetry, or if something goes wrong. | |
- name: cache poetry install | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }} | |
# Install Poetry. You could do this manually, or there are several actions that do this. | |
# `snok/install-poetry` seems to be minimal yet complete, and really just calls out to | |
# Poetry's default install script, which feels correct. I pin the Poetry version here | |
# because Poetry does occasionally change APIs between versions and I don't want my | |
# actions to break if it does. | |
# | |
# The key configuration value here is `virtualenvs-in-project: true`: this creates the | |
# venv as a `.venv` in your testing directory, which allows the next step to easily | |
# cache it. | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.3 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`) | |
- name: cache venv | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- run: poetry install --no-interaction | |
#- run: poetry run flake8 src/ tests/ | |
- run: poetry run pytest |