@@ -2,11 +2,12 @@ name: Python CI
22
33on :
44 pull_request :
5- branches : [ master ]
5+ branches : [ main, master ]
66 push :
7- branches : [ master ]
7+ branches : [ main, master ]
88 release :
99 types : [ released ]
10+ workflow_dispatch :
1011
1112jobs :
1213 lint :
@@ -15,32 +16,19 @@ jobs:
1516 steps :
1617 - uses : actions/checkout@v4
1718
18- - name : Set up Python
19+ - name : Install python
1920 uses : actions/setup-python@v5
2021 with :
2122 python-version : " 3.12"
2223
23- - name : Install Poetry
24- uses : ./.github/actions/setup- poetry
24+ - name : Install poetry
25+ run : pipx install poetry
2526
26- - name : Cache dependencies
27- uses : actions/cache@v4
28- with :
29- path : |
30- ~/.cache/pypoetry
31- ~/.cache/pip
32- key : ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
33- restore-keys : |
34- ${{ runner.os }}-poetry-
35-
36- - name : Install dependencies
27+ - name : Install package
3728 run : poetry install
3829
39- - name : Install tox
40- run : python -m pip install --upgrade tox
41-
42- - name : Run lint
43- run : tox -e lint
30+ - name : Run linters
31+ run : poetry run pre-commit run -a
4432
4533 test :
4634 name : Python ${{ matrix.python-version }} (${{ matrix.platform }})
@@ -76,52 +64,54 @@ jobs:
7664 steps :
7765 - uses : actions/checkout@v4
7866
79- - name : Install Python ${{ matrix.python-version }}
67+ - name : Install python ${{ matrix.python-version }}
8068 uses : actions/setup-python@v5
8169 with :
8270 python-version : ${{ matrix.python-version }}
8371
84- - name : Install Poetry
85- uses : ./.github/actions/setup-poetry
86-
87- - name : Install dependencies
88- run : poetry install
72+ - name : Install poetry
73+ run : pipx install poetry
8974
9075 - name : Install tox
91- run : python -m pip install --upgrade tox
76+ run : pipx install tox
77+
78+ - name : Install package
79+ run : poetry install
9280
9381 - name : Run tests
9482 run : tox -e ${{ matrix.toxenv }}
9583
96- - name : Run Codecov
84+ - name : Run codecov
9785 env :
98- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
86+ CODECOV_TOKEN :
87+ ${{ secrets.CODECOV_TOKEN }}
9988 run : tox -e codecov
10089
90+
10191 release :
10292 runs-on : ubuntu-latest
10393 needs : test
104- if : github.ref == 'refs/heads/master' && github.event_name == 'push'
94+ if : github.event_name == 'push' && (github. ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
10595
10696 steps :
10797 - uses : actions/checkout@v4
10898 with :
10999 fetch-depth : 0
110100
111- - name : Install Python
101+ - name : Install python
112102 uses : actions/setup-python@v5
113103 with :
114104 python-version : " 3.12"
115105
116- - name : Install Poetry
117- uses : ./.github/actions/setup- poetry
106+ - name : Install poetry
107+ run : pipx install poetry
118108
119- - name : Install dependencies
109+ - name : Install package
120110 run : poetry install
121111
122112 - name : Run semantic-release
123113 env :
124- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
114+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
125115 run : |
126116 git config --global user.email "[email protected] " 127117 git config --global user.name "semantic-release"
0 commit comments