bug(ci): fixes gh action artifact conflict error #427
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: [] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[dev]" | |
pip install -e ".[docs]" | |
# Output dependency versions | |
pip freeze | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Static type checking with mypy | |
run: | | |
mypy --version | |
mypy -p basin3d --python-version ${{ matrix.python-version }} | |
- name: Make artifact directory | |
run: | | |
mkdir -p ${{ github.workspace }}/artifacts | |
- name: Test with pytest | |
run: | | |
PYTHONPATH=. pytest -v -m "not mypy" --cov=basin3d --cov-report term --cov-report html:${{ github.workspace }}/artifacts | |
- name: Documentation and Doctests | |
run: | | |
cd docs | |
PYTHONPATH=.. make doctest linkcheck html | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: ${{ github.workspace }}/artifacts | |
# If true, an artifact with a matching name will be deleted before a new one is uploaded. | |
# If false, the action will fail if an artifact for the given name already exists. | |
# Does not fail if the artifact does not exist. | |
# Optional. Default is 'false' | |
overwrite: true |