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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
name: CI
on:
pull_request: {}
push: {}
jobs:
linux:
runs-on: ${{ matrix.PYTHON.OS || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
PYTHON:
# Base builds
- {VERSION: "3.8", NOXSESSION: "tests"}
- {VERSION: "3.9", NOXSESSION: "tests"}
- {VERSION: "3.10", NOXSESSION: "tests"}
- {VERSION: "3.11", NOXSESSION: "tests"}
- {VERSION: "3.12", NOXSESSION: "tests"}
- {VERSION: "3.13", NOXSESSION: "tests"}
- {VERSION: "3.14", NOXSESSION: "tests"}
- {VERSION: "3.14t", NOXSESSION: "tests"}
- {VERSION: "pypy-3.11", NOXSESSION: "tests"}
- {VERSION: "3.11", NOXSESSION: "tests-wheel", OS: "windows-latest"}
- {VERSION: "3.14t", NOXSESSION: "tests-wheel", OS: "windows-latest"}
# -cryptography-main
- {VERSION: "3.8", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.10", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.11", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.12", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.13", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.14", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.14t", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "pypy-3.11", NOXSESSION: "tests-cryptography-main"}
# -cryptography-minimum
- {VERSION: "3.8", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.10", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.11", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.12", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.13", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "pypy-3.11", NOXSESSION: "tests-cryptography-minimum"}
# Cryptography wheels
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum-wheel"}
- {VERSION: "3.9", NOXSESSION: "tests-wheel"}
# Random order
- {VERSION: "3.9", NOXSESSION: "tests-random-order"}
# aws-lc
- {VERSION: "3.14", NOXSESSION: "tests-cryptography-main", OPENSSL: {TYPE: "aws-lc", VERSION: "v1.70.0"}}
# Meta
- {VERSION: "3.9", NOXSESSION: "check-manifest"}
- {VERSION: "3.11", NOXSESSION: "lint"}
- {VERSION: "3.13", NOXSESSION: "mypy"}
- {VERSION: "3.9", NOXSESSION: "docs"}
steps:
- uses: actions/checkout@v6.0.2
- name: Setup python
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- name: Cache custom OpenSSL
if: matrix.PYTHON.OPENSSL
id: ossl-cache
uses: actions/cache@v5
with:
path: ~/ossl
key: ossl-${{ matrix.PYTHON.OPENSSL.TYPE }}-${{ matrix.PYTHON.OPENSSL.VERSION }}
- name: Build custom OpenSSL
if: matrix.PYTHON.OPENSSL && steps.ossl-cache.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch ${{ matrix.PYTHON.OPENSSL.VERSION }} https://github.com/aws/aws-lc.git
cmake -GNinja -B aws-lc/build -S aws-lc -DCMAKE_INSTALL_PREFIX="${HOME}/ossl" -DBUILD_TESTING=OFF
ninja -C aws-lc/build install
rm -rf aws-lc/
- name: Set up custom OpenSSL env
if: matrix.PYTHON.OPENSSL
run: |
cargo install bindgen-cli
echo "OPENSSL_DIR=${HOME}/ossl" >> $GITHUB_ENV
- run: python -m pip install nox
- run: nox
env:
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
- uses: ./.github/actions/upload-coverage
linux-docker:
runs-on: ubuntu-latest
container: ghcr.io/pyca/cryptography-runner-${{ matrix.TEST.CONTAINER }}
strategy:
fail-fast: false
matrix:
TEST:
# cryptography-main used since there's no wheel
- {CONTAINER: "ubuntu-rolling", NOXSESSION: "tests-cryptography-main"}
name: "${{ matrix.TEST.NOXSESSION }} on ${{ matrix.TEST.CONTAINER }}"
steps:
- uses: actions/checkout@v6.0.2
- run: /venv/bin/pip install nox
- run: /venv/bin/nox
env:
RUSTUP_HOME: /root/.rustup
NOXSESSION: ${{ matrix.TEST.NOXSESSION }}
- uses: ./.github/actions/upload-coverage
linux-downstream:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
DOWNSTREAM:
- twisted
- certbot
- certbot-josepy
PYTHON:
- 3.12
name: "Downstream tests for ${{ matrix.DOWNSTREAM }}"
steps:
- uses: actions/checkout@v6.0.2
- name: Setup python
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.PYTHON }}
- run: ./.github/downstream.d/${{ matrix.DOWNSTREAM }}.sh install
- run: pip install .
- run: ./.github/downstream.d/${{ matrix.DOWNSTREAM }}.sh run
all-green:
runs-on: ubuntu-latest
needs: [linux, linux-docker, linux-downstream]
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@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.1
timeout-minutes: 3
with:
persist-credentials: false
- name: Setup python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
timeout-minutes: 3
- run: pip install coverage[toml]
- name: Download coverage data
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: _html-report
path: htmlcov
if-no-files-found: ignore
|