Skip to content

Commit

Permalink
Merge pull request #16 from AlessandroMiola/add_gh_actions_config
Browse files Browse the repository at this point in the history
feat(ci): add tooling (github actions)
  • Loading branch information
AlessandroMiola authored Feb 9, 2024
2 parents a956bd0 + 6f38ac8 commit 1fdc7f9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Lint, Test

on:
push:
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: Setup just
uses: taiki-e/install-action@just

- name: Enforce code style (Ruff)
run: just ruff-show-violations

- name: Verify code formatting (Black)
run: just black-diff
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use PowerShell instead of sh
set shell := ["powershell.exe", "-c"]
# set shell := ["powershell.exe", "-c"]

help:
@just --list
Expand Down

0 comments on commit 1fdc7f9

Please sign in to comment.