Skip to content

Commit

Permalink
ci: add github actions configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroMiola committed Dec 30, 2023
1 parent 7d80a3a commit cf076cc
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Lint, Test

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
# New commit on branch cancels running workflows of the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHON_VERSION: 3.10
POETRY_VERSION: 1.6.1

jobs:
lint-and-test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached venv if cache exists
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies if cache does not exist
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install project
run: poetry install --no-interaction

- name: Verify code formatting (Black)
run: poetry run black --check --diff .

- name: Enforce code style (flake8)
continue-on-error: true
run: poetry run flake8 --show-source .

- name: Run tests
run: poetry run pytest --verbose

0 comments on commit cf076cc

Please sign in to comment.