Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Oct 16, 2023
1 parent a8ef678 commit b010d91
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/actions/install-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Install env
runs:
using: "composite"
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python
id: set-up-python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0

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

- name: Load cached virtual env
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.set-up-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

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

- name: Activate environment
shell: bash
run: source $VENV
18 changes: 18 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code quality

on:
pull_request:
branches:
- "*"
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-env
- name: Run pre-commit on all files
run: poetry run pre-commit run --all-files
18 changes: 18 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Unit tests

on:
pull_request:
branches:
- "*"
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-env
- name: Run pytest
run: poetry run pytest

0 comments on commit b010d91

Please sign in to comment.