Skip to content

Commit

Permalink
ci: update test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfountain1996 committed Nov 1, 2023
1 parent 12365c8 commit 960412e
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 70 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/main.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test

on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v4

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

- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('dev-requirements.txt', 'pyproject.toml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make install

- name: Run linter
run: |
make lint
make typecheck
test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v4

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

- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('dev-requirements.txt', 'pyproject.toml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make install

- name: Run tests
run: make test

- name: Display test coverage
run: make coverage
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
sources := src tests

install:
pip install --upgrade pip
pip install -r dev-requirements.txt
pip install -e .

test:
coverage run

Expand Down

0 comments on commit 960412e

Please sign in to comment.