chore: add github actions #5
Workflow file for this run
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: build-and-test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
paths: | |
- "**" | |
- "!docs/**" | |
- "!README.md" | |
- "!.github/**" | |
- .github/workflows/build-and-test.yaml | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check poetry existence | |
id: check-poetry | |
uses: andstor/file-existence-action@v3 | |
with: | |
fail: false | |
files: "poetry.lock" | |
- name: Install poetry | |
if: steps.check-poetry.outputs.files_exists == true | |
run: pip install poetry | |
- name: Setup python (with pip) | |
if: steps.check-poetry.outputs.files_exists == false | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
python-version-file: "pyproject.toml" | |
- name: Install dependencies | |
run: poetry install | |
- name: Run tests | |
run: poetry run pytest |