Implement GitHub actions #9
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: PR Pipeline | |
on: [pull_request] | |
env: # Need to replace with secrets eventually | |
MONGO_TOKEN: "" | |
ENV: "dev" | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Restore cached .venv | |
uses: actions/cache/restore@v4 | |
id: cache-venv | |
with: | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
path: .venv | |
- name: Setup environment | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config --list | |
- name: Install dependencies | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Cache .venv | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
path: .venv | |
test: | |
name: Test | |
needs: [build] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Restore cached .venv | |
uses: actions/cache/restore@v4 | |
with: | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
path: .venv | |
- name: Test setup | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
pip install pytest | |
- name: Run tests | |
run: poetry run pytest --doctest-modules --junitxml=junit/test-results.xml | |
lint: | |
name: Lint | |
needs: [build] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Restore cached .venv | |
uses: actions/cache/restore@v4 | |
with: | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
path: .venv | |
- name: Lint setup | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff | |
- name: Run linter | |
run: ruff check --output-format=github . |