-
Notifications
You must be signed in to change notification settings - Fork 14
133 lines (111 loc) · 3.39 KB
/
main.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: GH
on:
pull_request:
push:
branches: [master]
release:
types: [released, prereleased]
workflow_dispatch: # allows running workflow manually from the Actions tab
jobs:
CI:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python 2
if: matrix.python-version == '2.7'
run: |
sudo rm -f $(which python) $(which pip)
sudo apt-get install python2.7-dev
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python2.7 get-pip.py
sudo ln -sf "$(which python2.7)" "$(dirname $(which python2.7))/python"
- name: Pip cache
uses: actions/cache@v4
with:
save-always: true
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Pre-commit cache
uses: actions/cache@v4
with:
save-always: true
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ matrix.python-version }}-${{ hashFiles('**/requirements/ci.txt') }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Install dependencies
run: |
pip install -U pip setuptools wheel codecov
make install
- name: Lint
if: matrix.python-version == 3.12
run: make lint
- name: Test
run: make test
- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
codecov
windows-smoketest:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install
run: |
pip install -U pip setuptools wheel
pip install .
- name: Test (ascii)
run: pipgrip -vvv --tree pipgrip
- name: Test (unicode)
env:
PYTHONUTF8: '1'
run: pipgrip -vvv --tree pipgrip
CD:
needs: [CI, windows-smoketest]
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: write # softprops/action-gh-release
id-token: write # pypa/gh-action-pypi-publish
issues: write # apexskier/github-release-commenter
pull-requests: write # apexskier/github-release-commenter
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build
run: |
pip install -U pip setuptools wheel
python setup.py sdist bdist_wheel --universal
- name: Upload release assets
uses: softprops/action-gh-release@v2.0.5
with:
files: dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
- uses: apexskier/github-release-commenter@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
Released {release_link}