Skip to content

Commit

Permalink
Update CI.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
pstjohn committed Sep 19, 2022
1 parent fd980da commit 768ea18
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: CI

on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
push:
branches:
- 'main'
tags:
- '*'
pull_request:
branches:
- 'main'
schedule:
# Nightly tests run on master by default: (PSJ: this runs weekly on sunday)
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: '0 0 * * 0'

jobs:
Expand Down Expand Up @@ -48,12 +44,28 @@ jobs:
- name: Run tests
shell: bash -l {0}
run: pytest -v tests/
- name: CodeCov
uses: codecov/codecov-action@v1
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'

release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel setuptools_scm build
- name: Build package
run: >-
python -m build --sdist --wheel --outdir dist/ .
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
file: ./coverage.xml
flags: unittests
name:
codecov-{{ '${{ matrix.os }}' }}-py{{ '${{ matrix.python-version }}'
}}
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 768ea18

Please sign in to comment.