Merge pull request #7 from MarkusSagen/feat-flag-ignore-file-paths #29
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
name: Test and Lint | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
PROJECT_NAME: rejx | |
PYTHON_VERSION: 3.10.10 | |
POETRY_VERSION: 1.7.1 | |
jobs: | |
test_and_lint: | |
name: Lint and Test | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.cache-keys.outputs.cache-key }} | |
steps: | |
- uses: actions/checkout@v4 | |
################################################################### | |
# # | |
# Setup Project # | |
# # | |
################################################################### | |
- name: Setup Justfile | |
uses: extractions/setup-just@v1 | |
- name: Check justfile linting | |
run: 'just --unstable --fmt --check || "justfile is not formatted!\nrun: `just fmt` and commit again"' | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: pip | |
- name: Setup Poetry for Python | |
uses: abatilo/actions-poetry@v2 | |
with: | |
python-version: ${{ env.POETRY_VERSION }} | |
- name: Setup a local virtual environment (if no poetry.toml file) | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- uses: actions/cache@v3 | |
name: Define a cache for the virtual environment based on the dependencies lock file | |
with: | |
path: ./.venv | |
key: venv-${{ hashFiles('poetry.lock') }} | |
- name: Install the project dependencies | |
run: just setup | |
################################################################### | |
# # | |
# Linting and Format # | |
# # | |
################################################################### | |
- name: Lint code | |
run: just lint | |
################################################################### | |
# # | |
# Testing # | |
# # | |
################################################################### | |
- name: Run unit test | |
run: just test | |
################################################################### | |
# # | |
# CI/CD Bots # | |
# # | |
################################################################### | |
# https://pypi.org/project/pytest-md-report/ | |
- name: Run tests with reports | |
run: poetry run pytest --md-report --md-report-flavor gfm --md-report-output report.md |