Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2 on:
3 pull_request: {}
4 push: {}
5
6 jobs:
7 linux:
8 runs-on: ${{ matrix.PYTHON.OS || 'ubuntu-latest' }}
9 strategy:
10 fail-fast: false
11 matrix:
12 PYTHON:
13 # Base builds
14 - {VERSION: "3.8", NOXSESSION: "tests"}
15 - {VERSION: "3.9", NOXSESSION: "tests"}
16 - {VERSION: "3.10", NOXSESSION: "tests"}
17 - {VERSION: "3.11", NOXSESSION: "tests"}
18 - {VERSION: "3.12", NOXSESSION: "tests"}
19 - {VERSION: "3.13", NOXSESSION: "tests"}
20 - {VERSION: "3.14", NOXSESSION: "tests"}
21 - {VERSION: "3.14t", NOXSESSION: "tests"}
22 - {VERSION: "pypy-3.11", NOXSESSION: "tests"}
23 - {VERSION: "3.11", NOXSESSION: "tests-wheel", OS: "windows-latest"}
24 - {VERSION: "3.14t", NOXSESSION: "tests-wheel", OS: "windows-latest"}
25 # -cryptography-main
26 - {VERSION: "3.9", NOXSESSION: "tests-cryptography-main"}
27 - {VERSION: "3.10", NOXSESSION: "tests-cryptography-main"}
28 - {VERSION: "3.11", NOXSESSION: "tests-cryptography-main"}
29 - {VERSION: "3.12", NOXSESSION: "tests-cryptography-main"}
30 - {VERSION: "3.13", NOXSESSION: "tests-cryptography-main"}
31 - {VERSION: "3.14", NOXSESSION: "tests-cryptography-main"}
32 - {VERSION: "3.14t", NOXSESSION: "tests-cryptography-main"}
33 - {VERSION: "pypy-3.11", NOXSESSION: "tests-cryptography-main"}
34 # -cryptography-minimum
35 - {VERSION: "3.8", NOXSESSION: "tests-cryptography-minimum"}
36 - {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum"}
37 - {VERSION: "3.10", NOXSESSION: "tests-cryptography-minimum"}
38 - {VERSION: "3.11", NOXSESSION: "tests-cryptography-minimum"}
39 - {VERSION: "3.12", NOXSESSION: "tests-cryptography-minimum"}
40 - {VERSION: "3.13", NOXSESSION: "tests-cryptography-minimum"}
41 - {VERSION: "pypy-3.11", NOXSESSION: "tests-cryptography-minimum"}
42 # Cryptography wheels
43 - {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum-wheel"}
44 - {VERSION: "3.9", NOXSESSION: "tests-wheel"}
45 # Random order
46 - {VERSION: "3.9", NOXSESSION: "tests-random-order"}
47 # aws-lc
48 - {VERSION: "3.14", NOXSESSION: "tests-cryptography-main", OPENSSL: {TYPE: "aws-lc", VERSION: "v1.70.0"}}
49 # Meta
50 - {VERSION: "3.9", NOXSESSION: "check-manifest"}
51 - {VERSION: "3.11", NOXSESSION: "lint"}
52 - {VERSION: "3.13", NOXSESSION: "mypy"}
53 - {VERSION: "3.9", NOXSESSION: "docs"}
54 steps:
55 - uses: actions/[email protected]
56 - name: Setup python
57 uses: actions/[email protected]
58 with:
59 python-version: ${{ matrix.PYTHON.VERSION }}
60 - name: Cache custom OpenSSL
61 if: matrix.PYTHON.OPENSSL
62 id: ossl-cache
63 uses: actions/cache@v5
64 with:
65 path: ~/ossl
66 key: ossl-${{ matrix.PYTHON.OPENSSL.TYPE }}-${{ matrix.PYTHON.OPENSSL.VERSION }}
67 - name: Build custom OpenSSL
68 if: matrix.PYTHON.OPENSSL && steps.ossl-cache.outputs.cache-hit != 'true'
69 run: |
70 git clone --depth 1 --branch ${{ matrix.PYTHON.OPENSSL.VERSION }} https://github.com/aws/aws-lc.git
71 cmake -GNinja -B aws-lc/build -S aws-lc -DCMAKE_INSTALL_PREFIX="${HOME}/ossl" -DBUILD_TESTING=OFF
72 ninja -C aws-lc/build install
73 rm -rf aws-lc/
74 - name: Set up custom OpenSSL env
75 if: matrix.PYTHON.OPENSSL
76 run: |
77 cargo install bindgen-cli
78 echo "OPENSSL_DIR=${HOME}/ossl" >> $GITHUB_ENV
79 - run: python -m pip install nox
80 - run: nox
81 env:
82 NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
83 - uses: ./.github/actions/upload-coverage
84
85 linux-docker:
86 runs-on: ubuntu-latest
87 container: ghcr.io/pyca/cryptography-runner-${{ matrix.TEST.CONTAINER }}
88 strategy:
89 fail-fast: false
90 matrix:
91 TEST:
92 # cryptography-main used since there's no wheel
93 - {CONTAINER: "ubuntu-rolling", NOXSESSION: "tests-cryptography-main"}
94 name: "${{ matrix.TEST.NOXSESSION }} on ${{ matrix.TEST.CONTAINER }}"
95 steps:
96 - uses: actions/[email protected]
97 - run: /venv/bin/pip install nox
98 - run: /venv/bin/nox
99 env:
100 RUSTUP_HOME: /root/.rustup
101 NOXSESSION: ${{ matrix.TEST.NOXSESSION }}
102 - uses: ./.github/actions/upload-coverage
103
104 linux-downstream:
105 runs-on: ubuntu-latest
106 strategy:
107 fail-fast: false
108 matrix:
109 DOWNSTREAM:
110 - twisted
111 - certbot
112 - certbot-josepy
113 PYTHON:
114 - 3.12
115 name: "Downstream tests for ${{ matrix.DOWNSTREAM }}"
116 steps:
117 - uses: actions/[email protected]
118 - name: Setup python
119 uses: actions/[email protected]
120 with:
121 python-version: ${{ matrix.PYTHON }}
122 - run: ./.github/downstream.d/${{ matrix.DOWNSTREAM }}.sh install
123 - run: pip install .
124 - run: ./.github/downstream.d/${{ matrix.DOWNSTREAM }}.sh run
125
126 all-green:
127 runs-on: ubuntu-latest
128 needs: [linux, linux-docker, linux-downstream]
129 if: ${{ always() }}
130 timeout-minutes: 3
131 steps:
132 - name: Decide whether the needed jobs succeeded or failed
133 uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
134 with:
135 jobs: ${{ toJSON(needs) }}
136
137 - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.1
138 timeout-minutes: 3
139 with:
140 persist-credentials: false
141 - name: Setup python
142 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
143 with:
144 python-version: '3.12'
145 timeout-minutes: 3
146 - run: pip install coverage[toml]
147 - name: Download coverage data
148 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
149 with:
150 pattern: coverage-data-*
151 merge-multiple: true
152 - name: Combine coverage and fail if it's too low
153 id: combinecoverage
154 run: |
155 set +e
156 python -m coverage combine
157 echo "## Python Coverage" >> $GITHUB_STEP_SUMMARY
158 python -m coverage report -m --fail-under=98 > COV_REPORT
159 COV_EXIT_CODE=$?
160 cat COV_REPORT
161 if [ $COV_EXIT_CODE -ne 0 ]; then
162 echo "🚨 Python Coverage failed. Coverage too low." | tee -a $GITHUB_STEP_SUMMARY
163 fi
164 echo '```' >> $GITHUB_STEP_SUMMARY
165 cat COV_REPORT >> $GITHUB_STEP_SUMMARY
166 echo '```' >> $GITHUB_STEP_SUMMARY
167 exit $COV_EXIT_CODE
168 - name: Create coverage HTML
169 run: python -m coverage html
170 if: ${{ failure() && steps.combinecoverage.outcome == 'failure' }}
171 - name: Upload HTML report.
172 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
173 with:
174 name: _html-report
175 path: htmlcov
176 if-no-files-found: ignore