added a test workflow #2
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: Python Package | |
on: | |
push: | |
branches: [ main, master, development ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
working-directory: ./kew | |
run: | | |
python -m pip install --upgrade pip | |
pip install build pytest pytest-cov pytest-asyncio | |
pip install -e . | |
- name: Run tests with coverage | |
working-directory: ./kew | |
run: | | |
pytest --cov=kew --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./kew/coverage.xml | |
fail_ci_if_error: true | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install build dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Build package | |
working-directory: ./kew | |
run: python -m build | |
- name: Check package | |
working-directory: ./kew | |
run: twine check dist/* | |
- name: Store build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: kew/dist/ |