-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (146 loc) · 4.74 KB
/
push.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Push
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
PIP_CACHE: |
~/.cache/pip
~/.local/bin
~/.local/lib/python3.*/site-packages
MIMALLOC_CACHE: |
medvedi/libmimalloc.so*
medvedi/mimalloc.h
jobs:
static_checks:
name: Static checks
if: "!contains(github.event.head_commit.message, 'Bump version') || github.event_name != 'push'"
runs-on: ubuntu-22.04
steps:
- name: actions/checkout
uses: actions/checkout@v3
- name: actions/cache
uses: actions/[email protected]
with:
path: ${{ env.PIP_CACHE }}
key: ubuntu-22.04-pip-static-checks-${{ hashFiles('requirements-lint.txt') }}
restore-keys: ubuntu-22.04-pip-static-checks-
- name: pip
run: |
python3 -m pip install --user -r requirements-lint.txt --no-warn-script-location
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: make format
run: |
set +x
make format
if ! [ -z "$(git diff HEAD)" ]; then
echo "Some files modified after code formatting check."
git status --porcelain
exit 1
fi
- name: make lint
run: |
set +x
make lint
test:
name: Unit tests
if: "!contains(github.event.head_commit.message, 'Bump version') || github.event_name != 'push'"
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy:
matrix:
python-version: ["3.10", "3.11"]
fail-fast: false
steps:
- name: actions/checkout
uses: actions/checkout@v3
- uses: "actions/setup-python@v1"
with:
python-version: "${{ matrix.python-version }}"
- name: actions/cache
uses: actions/[email protected]
with:
path: ${{ env.PIP_CACHE }}
key: ubuntu-22.04-pip-test-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'requirements-test.txt') }}
restore-keys: ubuntu-22.04-pip-test-
- name: actions/cache
uses: actions/[email protected]
with:
path: ${{ env.MIMALLOC_CACHE }}
key: ubuntu-22.04-mimalloc-${{ hashFiles('medvedi/mimalloc.h') }}
restore-keys: ubuntu-22.04-mimalloc-
- name: mimalloc
run: make mimalloc
- name: pip
run: |
set -x
ls "$HOME/.local/bin"
[ ! -f "$HOME/.local/bin/pytest" ] && rm -rf "$HOME/.local/lib/python3.*/site-packages/*"
python3 -m pip install --user -r requirements.txt -r requirements-test.txt --no-warn-script-location
echo "$HOME/.local/bin" >> $GITHUB_PATH
python3 -m pip install --user --no-deps -e .
- name: test
run: |
set -x
ls "$HOME/.local/bin"
ls medvedi
PYTEST_WORKERS=2 PYTEST_EXTRA="--cov-report=xml --cov medvedi" make test
- uses: codecov/codecov-action@v1
name: codecov
with:
token: ${{ secrets.CODECOV_TOKEN }}
package:
name: Package build
if: "!contains(github.event.head_commit.message, 'Bump version') || github.event_name != 'push'"
runs-on: ubuntu-22.04
steps:
- name: actions/checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: 3.11
- name: install build
run: python3 -m pip install --user build twine auditwheel
- name: actions/cache
uses: actions/[email protected]
with:
path: ${{ env.MIMALLOC_CACHE }}
key: ubuntu-22.04-mimalloc-${{ hashFiles('medvedi/mimalloc.h') }}
restore-keys: ubuntu-22.04-mimalloc-
- name: mimalloc
run: make mimalloc
- name: build
run: |
set +x
python3 -m build
ls dist
twine --version
auditwheel repair --plat manylinux_2_35_x86_64 dist/*.whl
bump_version:
name: Bump the version
needs: [ static_checks, test, package ]
if: "!contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && github.event_name == 'push'"
runs-on: ubuntu-22.04
steps:
- name: actions/checkout
uses: actions/checkout@v3
with:
fetch-depth: 100
persist-credentials: false
- name: current_version
run: echo "current_version=$(grep '__version__' medvedi/metadata.py | cut -d\" -f2)" >> $GITHUB_ENV
- name: FragileTech/bump-version
uses: FragileTech/bump-version@main
with:
current_version: "${{ env.current_version }}"
files: medvedi/metadata.py
commit_name: Groundskeeper Willie
commit_email: [email protected]
login: gkwillie
token: ${{ secrets.GKWILLIE_TOKEN }}