Test #268
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: Test | |
on: | |
push: | |
pull_request: | |
schedule: [{cron: '10 23 * * 6'}] # M H d m w (Sat at 23:10) | |
jobs: | |
test: | |
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) | |
name: py${{ matrix.python }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [3.7, 3.11] | |
steps: | |
- uses: actions/checkout@v4 | |
with: {fetch-depth: 0} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- run: pip install -U .[dev] | |
- run: pytest --durations-min=1 | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
matlab: | |
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) | |
name: MATLAB py${{ matrix.python }} | |
runs-on: [self-hosted, python, matlab] | |
strategy: | |
matrix: | |
python: [3.7, 3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
with: {fetch-depth: 0} | |
- name: Run setup-python | |
run: setup-python -p${{ matrix.python }} | |
- run: pip install -U .[dev] 'setuptools<66' # ignore matlab engine PEP440 non-compliance https://github.com/pypa/setuptools/issues/3772 | |
- run: pytest --durations-min=1 | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Post Run setup-python | |
run: setup-python -p${{ matrix.python }} -Dr | |
if: ${{ always() }} | |
deploy: | |
needs: [test, matlab] | |
name: PyPI Deploy | |
environment: pypi | |
permissions: {contents: write, id-token: write} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: {python-version: '3.x'} | |
- id: dist | |
uses: casperdcl/deploy-pypi@v2 | |
with: | |
build: true | |
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | |
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
name: Release | |
run: | | |
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD) | |
tag="${GITHUB_REF#refs/tags/}" | |
gh release create --title "spm12 $tag beta" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }} |