Skip to content

Commit

Permalink
chore(ci): setup test pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: JP-Ellis <josh@jpellis.me>
  • Loading branch information
JP-Ellis committed Feb 27, 2024
1 parent d8628a8 commit bdb808c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
HATCH_VERBOSE: "1"

jobs:
test:
name: >
${{ matrix.directory == '.' && 'Core' || matrix.directory == 'pypacter-api' && 'API' || 'CLI' }}
Python ${{ matrix.python-version }}
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
directory: [".", "pypacter-api", "pypacter-cli"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade hatch

- name: Run lints
working-directory: ${{ matrix.directory}}
run: |
hatch run format --check
hatch run lint
hatch run typecheck
- name: Run tests
working-directory: ${{ matrix.directory}}
run: |
hatch run test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2 changes: 1 addition & 1 deletion pypacter-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pre-install-commands = [
# The update is necessary as we are not using editable installs
lint = "ruff check --show-source --show-fixes {args} src tests"
typecheck = "mypy src tests {args}"
format = "ruff format src tests docs {args}"
format = "ruff format src tests {args}"
test = "pytest tests/ {args}"
all = ["format", "lint", "typecheck", "test"]

Expand Down

0 comments on commit bdb808c

Please sign in to comment.