-
Notifications
You must be signed in to change notification settings - Fork 419
132 lines (128 loc) · 5.14 KB
/
ci.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
name: CI
on:
pull_request: {}
push: {}
jobs:
linux:
runs-on: ${{ matrix.PYTHON.OS || 'ubuntu-22.04' }}
strategy:
matrix:
PYTHON:
# Base builds
- {VERSION: "3.7", TOXENV: "py37"}
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.9", TOXENV: "py39"}
- {VERSION: "3.10", TOXENV: "py310"}
- {VERSION: "3.11", TOXENV: "py311"}
- {VERSION: "3.12", TOXENV: "py312"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
- {VERSION: "3.11", TOXENV: "py311-useWheel", OS: "windows-2022" }
# -cryptographyMain
- {VERSION: "3.7", TOXENV: "py37-cryptographyMain"}
- {VERSION: "3.8", TOXENV: "py38-cryptographyMain"}
- {VERSION: "3.9", TOXENV: "py39-cryptographyMain"}
- {VERSION: "3.10", TOXENV: "py310-cryptographyMain"}
- {VERSION: "3.11", TOXENV: "py311-cryptographyMain"}
- {VERSION: "3.12", TOXENV: "py312-cryptographyMain"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3-cryptographyMain"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3-cryptographyMain"}
# -cryptographyMinimum
- {VERSION: "3.7", TOXENV: "py37-cryptographyMinimum"}
- {VERSION: "3.8", TOXENV: "py38-cryptographyMinimum"}
- {VERSION: "3.9", TOXENV: "py39-cryptographyMinimum"}
- {VERSION: "3.10", TOXENV: "py310-cryptographyMinimum"}
- {VERSION: "3.11", TOXENV: "py311-cryptographyMinimum"}
- {VERSION: "3.12", TOXENV: "py312-cryptographyMinimum"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3-cryptographyMinimum"}
# Cryptography wheels
- {VERSION: "3.9", TOXENV: "py39-cryptographyMinimum-useWheel"}
- {VERSION: "3.9", TOXENV: "py39-useWheel"}
# Random order
- {VERSION: "3.9", TOXENV: "py39-randomorder"}
# Downstreams
- {VERSION: "3.11", TOXENV: "py311-twistedTrunk"}
# Meta
- {VERSION: "3.9", TOXENV: "check-manifest"}
- {VERSION: "3.11", TOXENV: "lint"}
- {VERSION: "3.11", TOXENV: "py311-mypy"}
- {VERSION: "3.9", TOXENV: "docs"}
name: "${{ matrix.PYTHON.TOXENV }}${{ matrix.PYTHON.OS && format(' on {0}', matrix.PYTHON.OS) || '' }}"
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- run: python -m pip install tox coverage
- run: tox -v
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
- uses: ./.github/actions/upload-coverage
linux-docker:
runs-on: ubuntu-latest
container: ghcr.io/pyca/cryptography-runner-${{ matrix.TEST.CONTAINER }}
strategy:
matrix:
TEST:
# cryptographyMain used since there's no wheel
- {CONTAINER: "ubuntu-rolling", TOXENV: "py312-cryptographyMain"}
name: "${{ matrix.TEST.TOXENV }} on ${{ matrix.TEST.CONTAINER }}"
steps:
- uses: actions/checkout@v4
- run: /venv/bin/pip install tox
- run: /venv/bin/tox -v
env:
TOXENV: ${{ matrix.TEST.TOXENV }}
RUSTUP_HOME: /root/.rustup
- uses: ./.github/actions/upload-coverage
all-green:
runs-on: ubuntu-latest
needs: [linux, linux-docker]
if: ${{ always() }}
timeout-minutes: 3
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
timeout-minutes: 3
with:
persist-credentials: false
- name: Setup python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.12'
timeout-minutes: 3
- run: pip install coverage[toml]
- name: Download coverage data
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage and fail if it's too low
id: combinecoverage
run: |
set +e
python -m coverage combine
echo "## Python Coverage" >> $GITHUB_STEP_SUMMARY
python -m coverage report -m --fail-under=98 > COV_REPORT
COV_EXIT_CODE=$?
cat COV_REPORT
if [ $COV_EXIT_CODE -ne 0 ]; then
echo "🚨 Python Coverage failed. Coverage too low." | tee -a $GITHUB_STEP_SUMMARY
fi
echo '```' >> $GITHUB_STEP_SUMMARY
cat COV_REPORT >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit $COV_EXIT_CODE
- name: Create coverage HTML
run: python -m coverage html
if: ${{ failure() && steps.combinecoverage.outcome == 'failure' }}
- name: Upload HTML report.
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: _html-report
path: htmlcov
if-no-files-found: ignore