11name : Check, test and release
22on :
33 push :
4+ branches :
5+ - main
46 pull_request :
7+ release :
8+ types :
9+ - published
510 schedule :
611 - cron : ' 0 7 * * 1' # M H d m w (Mondays at 7:00)
12+ workflow_dispatch :
713
814concurrency :
915 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1016 cancel-in-progress : true
1117
18+ permissions :
19+ contents : read
20+
1221jobs :
13- check :
14- if : startsWith(github.ref, 'refs/tags') || github.event_name == 'pull_request' || github.event_name == 'schedule' || github.repository_owner != 'iterative'
15- name : Check
16- runs-on : ubuntu-latest
17- timeout-minutes : 10
18- steps :
19- - uses : actions/checkout@v4
20- with :
21- fetch-depth : 0
22- - uses : actions/setup-python@v5
23- with :
24- python-version : ' 3.11'
25- - run : pip install -e .[dev]
26- -
uses :
pre-commit/[email protected] 27- env :
28- SKIP : pylint
2922 test :
30- if : startsWith(github.ref, 'refs/tags') || github.event_name == 'pull_request' || github.event_name == 'schedule' || github.repository_owner != 'iterative'
31- name : Test ${{ matrix.os }} with py${{ matrix.python }}
23+ timeout-minutes : 10
3224 runs-on : ${{ matrix.os }}
3325 strategy :
26+ fail-fast : false
3427 matrix :
3528 os : [ubuntu-latest, macos-latest, windows-latest]
3629 python : ["3.9", "3.10", "3.11", "3.12"]
37- fail-fast : false
38- timeout-minutes : 10
30+
3931 steps :
4032 - uses : actions/checkout@v4
4133 with :
4234 fetch-depth : 0
35+
4336 - uses : actions/setup-python@v5
4437 with :
4538 python-version : ${{ matrix.python }}
4639 cache : ' pip'
47- cache-dependency-path : ' setup.py'
48- - name : Install
49- run : |
50- pip install --upgrade pip setuptools wheel
51- pip install pre-commit .[dev]
52- - run : pre-commit run pylint -a -v --show-diff-on-failure
40+ cache-dependency-path : ' pyproject.toml'
41+
42+ - run : pip install .[dev]
43+ -
uses :
pre-commit/[email protected] 5344 - name : Run tests
5445 run : |
5546 git config --global user.email "[email protected] " @@ -58,16 +49,20 @@ jobs:
5849 env :
5950 GITHUB_MATRIX_OS : ${{ matrix.os }}
6051 GITHUB_MATRIX_PYTHON : ${{ matrix.python }}
52+
6153 - name : " Upload coverage to Codecov"
6254 uses : codecov/codecov-action@v4
6355 with :
6456 fail_ci_if_error : false
6557 token : ${{ secrets.CODECOV_TOKEN }}
58+
6659 deploy :
6760 name : PyPI Deploy
68- environment : pypi
61+ environment :
62+ name : pypi
63+ url : https://pypi.org/p/gto
6964 permissions :
70- contents : write
65+ contents : read
7166 id-token : write
7267 runs-on : ubuntu-latest
7368 steps :
@@ -76,15 +71,10 @@ jobs:
7671 fetch-depth : 0
7772 - uses : actions/setup-python@v5
7873 with :
79- python-version : ' 3.11 '
80- - uses : casperdcl/deploy-pypi@v2
81- with :
82- build : true
83- upload : false
84- - if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
74+ python-version : ' 3.12 '
75+
76+ - run : pip install build twine
77+ - run : python -m build
78+ - run : twine check --strict dist/*
79+ - if : github.event_name == 'release'
8580 uses : pypa/gh-action-pypi-publish@release/v1
86- - id : meta
87- name : Changelog
88- run : |
89- echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
90- git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
0 commit comments