-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (65 loc) · 1.89 KB
/
main_test_and_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Workflow which does the following
# 1) run pytest
# 2) updates the version according to semantic versioning
# 3) creates a release
# 4) uploads the package to pypi
name: Pytest
on:
pull_request:
push:
branches:
- main
env:
cache-version: 0.0.9 # Change this number if you want to manually invalidate all caches
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
env:
python-version: ${{ matrix.python-version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run tests
uses: ./.github/actions/test
with:
python-version: ${{ env.python-version }}
jupyter-tutorials:
runs-on: ${{ matrix.os }}
env:
python-version: "3.9"
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run tests
uses: ./.github/actions/test_tutorials
with:
python-version: ${{ env.python-version }}
release:
runs-on: ubuntu-latest
needs: test
if: ${{ github.ref == 'refs/heads/main' }}
steps:
# Checkout action is required for token to persist
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_BOT }}
- name: Python Semantic Release
uses: relekang/python-semantic-release@v7.34.4
with:
github_token: ${{ secrets.RELEASE_BOT }}
# Remember to copy the tool.semantic_release section from pyproject.toml
# as well
# To enable pypi,
# 1) Set upload_to_pypi to true in pyproject.toml and
# 2) Set the pypi_token in the repo
# 3) Uncomment the two lines below
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}