Debian Codegraph @

.github/workflows/ci.yml

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