-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (104 loc) · 3.58 KB
/
Copy pathbuild.yml
File metadata and controls
135 lines (104 loc) · 3.58 KB
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
name: Test
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:
permissions: read-all
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true
jobs:
check_changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set Up Git Identity
run: |
git fetch -v -v -v --all --unshallow
git switch "${{ github.REF_NAME }}" || git switch "${{ github.HEAD_REF }}"
git config --global user.email "$(git log -1 --pretty=format:'%ae' | xargs)"
git config --global user.name "${{ github.actor }}"
git remote set-url origin "https://${{ github.actor }}:${{ secrets.PUSH_TOKEN }}@github.com/${{ github.repository }}"
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install pipx==1.2.1
- name: Update Pre-Commits
run: |
pipx install pre-commit==3.5.0
pre-commit autoupdate
differences=$(git diff | xargs)
if [ -z "$differences" ]; then
echo "No changes needed"
exit 0
fi
echo "::error::The pre-commit hooks are outdated"
echo "$differences"
git add --all
git commit -m "chore(test): update versions of pre-commit hooks"
git push
sleep 30
exit 1
- name: Update Version and Changelog
run: |
pipx install python-semantic-release==8.3.0
semantic-release -v version --no-vcs-release --no-commit
differences=$(git diff | xargs)
if [ -z "$differences" ]; then
echo "No changes needed"
exit 0
fi
echo "::error::The version and/or Changelog is outdated"
echo "$differences"
git add --all
git commit -m "chore(release): bump version and update changelog"
git push
sleep 30
exit 1
test:
runs-on: ubuntu-latest
needs: check_changelog
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Install Global Dependencies
run: |
pip install pipx
- name: Check Linting and Format
run: |
pip install -e .
pip install pre-commit==3.5.0
pre-commit run --all-files
- name: Run Tests
run: |
pip install pytest pytest-cov
pytest --cov --cov-report=xml:coverage-report.xml
# - name: Check Breaking changes
# run: |
# git fetch -v -v -v --all --unshallow
# git switch "${{ github.REF_NAME }}" || git switch "${{ github.HEAD_REF }}"
# pipx install .
# pipx install python-semantic-release==8.3.0
# git-stats-report -vv -t "$(semantic-release -v version --print)"
- name: Check Build and Wheel
run: |
pipx run build
pipx run twine check --strict dist/*