Skip to content

Commit

Permalink
Add tag matching
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-moth committed Feb 7, 2023
1 parent 1460eb1 commit ddd65b3
Showing 1 changed file with 10 additions and 89 deletions.
99 changes: 10 additions & 89 deletions .github/workflows/ci.yaml
Expand Up @@ -35,98 +35,11 @@ jobs:
name: "Python package"
path: dist

test:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: ["build"]

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/environment
with:
python-version: ${{ matrix.python-version }}

- name: Run tests
shell: bash -l {0}
run: |
pytest -v \
--junitxml=junit-py${{ matrix.python-version }}.xml \
--cov --cov-report term \
--cov-report xml:coverage-${{ matrix.python-version }}.xml
- name: JUnit Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: 'junit-py*.xml'
check_name: "JUnit Test Report - Python ${{ matrix.python-version }}"

- uses: actions/upload-artifact@v3
with:
name: Code coverage for Python ${{ matrix.python-version }}
path: coverage-*.xml

lint:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: ["build"]

defaults:
run:
shell: bash -l {0}

env:
python_version: "3.11"

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/environment
with:
python-version: ${{ env.python_version }}

- name: 'mypy cache'
uses: actions/cache@v3
with:
path: '.mypy_cache'
key: mypy-${{ runner.os }}-py${{ env.python_version }}-${{ hashFiles('requirements.txt') }}

- run: flake8 src/ tests/
- run: isort --diff --check-only src/ tests/
- run: mypy --junit-xml report-mypy.xml src/

docs:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: ["build"]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/environment
with:
python-version: "3.11"

- run: |
cd docs/
sphinx-build -b dirhtml -aEW . _build/dirhtml
- uses: actions/upload-artifact@v3
with:
name: Docs
path: docs/_build/dirhtml

publish:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: ['test', 'lint', 'docs']
# needs: ['test', 'lint', 'docs']
needs: ['build']
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

steps:
Expand All @@ -135,6 +48,14 @@ jobs:
with:
name: "Python package"

- name: "Check tag matches version"
shell: bash -l {0}
run: |
VERSION="$( echo "${{ github.ref }}" | sed 's!refs/tags/v!!' )"
echo "Looking for packages with version $VERSION"
test -e "dist/emsarray-$VERSION.tar.gz"
test -e "dist/emsarray-$VERSION-*.whl"
- name: "Publish Python package"
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit ddd65b3

Please sign in to comment.