Skip to content

Commit

Permalink
CI: Use more generic GHA tests workflow (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianeboyd committed Apr 18, 2023
1 parent e067040 commit 1c4ac2d
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/tests.yml
Expand Up @@ -2,12 +2,21 @@ name: tests

on:
push:
paths-ignore:
- "*.md"
pull_request:
types: [opened, synchronize, reopened, edited]
paths-ignore:
- "*.md"

env:
MODULE_NAME: 'catalogue'
RUN_MYPY: 'true'

jobs:
tests:
name: Test
if: github.repository_owner == 'explosion'
strategy:
fail-fast: false
matrix:
Expand All @@ -32,28 +41,37 @@ jobs:
python -m build --sdist
- name: Run mypy
run: python -m mypy catalogue
shell: bash
if: ${{ env.RUN_MYPY == 'true' }}
run: |
python -m mypy $MODULE_NAME
- name: Delete source directory
run: rm -rf catalogue
shell: bash
run: |
rm -rf $MODULE_NAME
- name: Uninstall all packages
run: |
python -m pip freeze > installed.txt
python -m pip uninstall -y -r installed.txt
- name: Install from sdist
shell: bash
run: |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
pip install dist/$SDIST
shell: bash
- name: Test import
run: python -c "import catalogue"
shell: bash
run: |
python -c "import $MODULE_NAME" -Werror
- name: Install test requirements
run: python -m pip install -U -r requirements.txt
run: |
python -m pip install -U -r requirements.txt
- name: Run tests
run: python -m pytest --pyargs catalogue -Werror
shell: bash
run: |
python -m pytest --pyargs $MODULE_NAME -Werror

0 comments on commit 1c4ac2d

Please sign in to comment.