-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (114 loc) · 3.73 KB
/
Copy pathci.yml
File metadata and controls
139 lines (114 loc) · 3.73 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
136
137
138
139
name: CI
on:
push:
branches:
- 'main'
paths-ignore:
- '.changelog.d/**'
- '.github/workflows/*'
- 'CHANGELOG.*'
- 'README.*'
- 'hatch.toml'
- 'pyproject.toml'
- 'src/*/__about__.py'
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1
permissions:
contents: read
jobs:
test:
name: 'Test with python ${{ matrix.python-version }} on ${{ matrix.os }}'
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy3.7', 'pypy3.8', 'pypy3.9']
include:
- os: macos-latest
python-version: '3.7'
- os: macos-latest
python-version: '3.11'
- os: windows-latest
python-version: '3.7'
- os: windows-latest
python-version: '3.11'
steps:
- name: 'Checkout'
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: 'Install python'
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: ${{ matrix.python-version }}
- name: 'Install hatch'
run: |
python -m pip install --upgrade hatch
- name: 'Run tests'
run: >
hatch run +py=${{ matrix.python-version }} ci:cov
--data-file '.coverage.${{ matrix.os }}.${{ matrix.python-version }}'
- name: 'Upload coverage'
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: coverage
path: '.coverage.*'
if-no-files-found: error
retention-days: 30
covbadge:
if: github.repository == 'jamielinux/httpdate' && github.ref == 'refs/heads/main'
name: 'Code coverage badge'
timeout-minutes: 20
runs-on: ubuntu-latest
needs: [test]
steps:
- name: 'Harden Runner'
uses: step-security/harden-runner@1f99358870fe1c846a3ccba386cc2b2246836776 # v2.2.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
files.pythonhosted.org:443
github.com:443
pypi.org:443
- name: 'Checkout'
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: 'Install python'
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: '3.11'
- name: 'Install hatch'
run: |
python -m pip install --upgrade hatch
- name: 'Download coverage'
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: coverage
- name: 'Combine coverage'
run: |
hatch run +py=3.11 ci:cov-combine
export TOTAL=$(python -c \
"import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: 'Coverage badge'
uses: schneegans/dynamic-badges-action@5d424ad4060f866e4d1dab8f8da0456e6b1c4f56 # v1.6.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: f3b70fb7174f1a8a87f2185e80cbb2ef
filename: httpdate.covbadge.json
label: coverage
message: ${{ env.total }}%
minColorRange: 70
maxColorRange: 90
valColorRange: ${{ env.total }}