From a2f99d8059514e02f60891ab99e32c972bd139e2 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 31 Oct 2024 17:31:31 +0100 Subject: [PATCH 01/23] Run tests on Windows and MacOS Signed-off-by: Alexis --- .github/workflows/tests.yml | 51 ++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c276fad..4dbd49d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + test-ubuntu: strategy: matrix: python: @@ -16,6 +16,7 @@ jobs: - "3.11" - "3.12" - "3.13" + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -38,3 +39,51 @@ jobs: - name: test run: make test INSTALL_EXTRA=test + + test-windows: + strategy: + matrix: + python: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.18" + enable-cache: true + cache-dependency-glob: pyproject.toml + + - name: Install Python ${{ matrix.python }} + run: uv python install ${{ matrix.python }} + + - name: Install OpenSSL} + env: + OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" + OPENSSL_PATH: "C:\\OpenSSL-Win64" + run: | + curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" + Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait + echo "Installed OpenSSL version:" + Start-Process -FilePath "${env:OPENSSL_PATH}\\bin\\openssl.exe" -ArgumentList "version" -Wait -NoNewWindow + + - name: Setup rust + uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 + with: + components: rustfmt + toolchain: 1.81.0 + + - name: test + run: make test INSTALL_EXTRA=test + shell: bash + env: + OPENSSL_DIR: "C:\\OpenSSL-Win64" + OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" + OPENSSL_NO_VENDOR: 1 From fc6f829c9bf0f77c4e45c81ab9ad9d046b57ab11 Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 1 Nov 2024 10:21:18 +0100 Subject: [PATCH 02/23] Fix tests Signed-off-by: Alexis --- .github/workflows/tests.yml | 75 +++--- rust/Cargo.lock | 477 ------------------------------------ rust/tsp-asn1/Cargo.lock | 81 ------ 3 files changed, 38 insertions(+), 595 deletions(-) delete mode 100644 rust/Cargo.lock delete mode 100644 rust/tsp-asn1/Cargo.lock diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4dbd49d..b7bb345 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,47 +7,47 @@ on: pull_request: jobs: - test-ubuntu: - strategy: - matrix: - python: - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v3 - with: - version: "0.4.18" - enable-cache: true - cache-dependency-glob: pyproject.toml - - - name: Install Python ${{ matrix.python }} - run: uv python install ${{ matrix.python }} - - - name: Setup rust - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 - with: - components: rustfmt - toolchain: 1.81.0 - - - name: test - run: make test INSTALL_EXTRA=test +# test-ubuntu: +# strategy: +# matrix: +# python: +# - "3.9" +# - "3.10" +# - "3.11" +# - "3.12" +# - "3.13" +# +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# +# - name: Install the latest version of uv +# uses: astral-sh/setup-uv@v3 +# with: +# version: "0.4.18" +# enable-cache: true +# cache-dependency-glob: pyproject.toml +# +# - name: Install Python ${{ matrix.python }} +# run: uv python install ${{ matrix.python }} +# +# - name: Setup rust +# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 +# with: +# components: rustfmt +# toolchain: 1.81.0 +# +# - name: test +# run: make test INSTALL_EXTRA=test test-windows: strategy: matrix: python: - - "3.9" - - "3.10" - - "3.11" - - "3.12" +# - "3.9" +# - "3.10" +# - "3.11" +# - "3.12" - "3.13" runs-on: windows-latest @@ -64,7 +64,7 @@ jobs: - name: Install Python ${{ matrix.python }} run: uv python install ${{ matrix.python }} - - name: Install OpenSSL} + - name: Install OpenSSL env: OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" OPENSSL_PATH: "C:\\OpenSSL-Win64" @@ -87,3 +87,4 @@ jobs: OPENSSL_DIR: "C:\\OpenSSL-Win64" OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" OPENSSL_NO_VENDOR: 1 + PYO3_PYTHON: "$(uv python dir)\\python.exe" diff --git a/rust/Cargo.lock b/rust/Cargo.lock deleted file mode 100644 index 922b6eb..0000000 --- a/rust/Cargo.lock +++ /dev/null @@ -1,477 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "asn1" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a10032de7d9e6f21c3f1cb1c9c0f94cf30ef67f38310588fe6cfa53e0d3f0" -dependencies = [ - "asn1_derive", -] - -[[package]] -name = "asn1_derive" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df30ecdcaf8338675a1413460a1b11df89789e1fcc6a10dc52f6e38b6982aa2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cc" -version = "1.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "cryptography-x509" -version = "0.1.0" -source = "git+https://github.com/pyca/cryptography.git#2378e53f26102dffee85a89524ca83b37eb801c8" -dependencies = [ - "asn1", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "indoc" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "openssl" -version = "0.10.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-src" -version = "300.3.2+3.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - -[[package]] -name = "portable-atomic" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pyo3" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51" -dependencies = [ - "cfg-if", - "indoc", - "libc", - "memoffset", - "once_cell", - "portable-atomic", - "pyo3-build-config", - "pyo3-ffi", - "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179" -dependencies = [ - "once_cell", - "target-lexicon", -] - -[[package]] -name = "pyo3-ffi" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d" -dependencies = [ - "libc", - "pyo3-build-config", -] - -[[package]] -name = "pyo3-macros" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e655aad15e09b94ffdb3ce3d217acf652e26bbc37697ef012f5e5e348c716e5e" -dependencies = [ - "proc-macro2", - "pyo3-macros-backend", - "quote", - "syn", -] - -[[package]] -name = "pyo3-macros-backend" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1e3f09eecd94618f60a455a23def79f79eba4dc561a97324bf9ac8c6df30ce" -dependencies = [ - "heck", - "proc-macro2", - "pyo3-build-config", - "quote", - "syn", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rfc3161-client" -version = "0.1.0" -dependencies = [ - "asn1", - "cryptography-x509", - "hex", - "openssl", - "pyo3", - "rand", - "self_cell", - "sha2", - "tsp-asn1", -] - -[[package]] -name = "self_cell" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - -[[package]] -name = "tsp-asn1" -version = "0.0.1" -dependencies = [ - "asn1", - "cryptography-x509", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unindent" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/rust/tsp-asn1/Cargo.lock b/rust/tsp-asn1/Cargo.lock deleted file mode 100644 index 75df9c4..0000000 --- a/rust/tsp-asn1/Cargo.lock +++ /dev/null @@ -1,81 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "asn1" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a10032de7d9e6f21c3f1cb1c9c0f94cf30ef67f38310588fe6cfa53e0d3f0" -dependencies = [ - "asn1_derive", -] - -[[package]] -name = "asn1_derive" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df30ecdcaf8338675a1413460a1b11df89789e1fcc6a10dc52f6e38b6982aa2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "cryptography-x509" -version = "0.1.0" -source = "git+https://github.com/pyca/cryptography.git#cb5ad845146af67ddeda1ce8fdf00e1755f86a82" -dependencies = [ - "asn1", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "syn" -version = "2.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tsp-asn1" -version = "0.0.1" -dependencies = [ - "asn1", - "cryptography-x509", - "hex", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" From 505f76d05cfc080258706ccf55bafdb06be1c516 Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 1 Nov 2024 18:14:51 +0100 Subject: [PATCH 03/23] Update dependency Signed-off-by: Alexis --- rust/Cargo.toml | 2 +- rust/tsp-asn1/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 8fec16b..7b3e05f 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -15,7 +15,7 @@ crate-type = ["cdylib"] [dependencies] tsp-asn1 = { path = "tsp-asn1" } pyo3 = { version = "0.22.5", features = ["abi3"] } -asn1 = "0.17" +asn1 = "0.18" self_cell = "1" hex = "0.4" sha2 = "0.10.8" diff --git a/rust/tsp-asn1/Cargo.toml b/rust/tsp-asn1/Cargo.toml index 45ae1a1..1017230 100644 --- a/rust/tsp-asn1/Cargo.toml +++ b/rust/tsp-asn1/Cargo.toml @@ -11,7 +11,7 @@ publish = false name = "tsp_asn1" [dependencies] -asn1 = "0.17" +asn1 = "0.18" cryptography-x509 = { git = "https://github.com/pyca/cryptography.git"} [dev-dependencies] From d2f4c36d995bbc40ad964d6f0d464d07e89be01f Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 1 Nov 2024 18:19:11 +0100 Subject: [PATCH 04/23] Update dependency Signed-off-by: Alexis --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b7bb345..3af2e6c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -87,4 +87,4 @@ jobs: OPENSSL_DIR: "C:\\OpenSSL-Win64" OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" OPENSSL_NO_VENDOR: 1 - PYO3_PYTHON: "$(uv python dir)\\python.exe" + # PYO3_PYTHON: "$(uv python dir)\\python.exe" From c199c02bf81c25f311cc71ac438ecd1a97f56e13 Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 1 Nov 2024 18:23:21 +0100 Subject: [PATCH 05/23] Restore other Python Versions Signed-off-by: Alexis --- .github/workflows/tests.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3af2e6c..b1a8d1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,10 +44,10 @@ jobs: strategy: matrix: python: -# - "3.9" -# - "3.10" -# - "3.11" -# - "3.12" + - "3.9" + - "3.10" + - "3.11" + - "3.12" - "3.13" runs-on: windows-latest @@ -71,8 +71,6 @@ jobs: run: | curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait - echo "Installed OpenSSL version:" - Start-Process -FilePath "${env:OPENSSL_PATH}\\bin\\openssl.exe" -ArgumentList "version" -Wait -NoNewWindow - name: Setup rust uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 From fcbdf06c946bfdc8fd3de6561c35945000eeebd1 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 14:04:01 +0100 Subject: [PATCH 06/23] Debug directories Signed-off-by: Alexis --- .github/workflows/tests.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b1a8d1e..5001aa8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,10 +45,10 @@ jobs: matrix: python: - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" +# - "3.10" +# - "3.11" +# - "3.12" +# - "3.13" runs-on: windows-latest steps: @@ -78,8 +78,18 @@ jobs: components: rustfmt toolchain: 1.81.0 + - name: Get env variables + shell: bash + run: | + UV_PYTHON_PATH="$(uv python dir)" + echo $UV_PYTHON_PATH + echo "PATH=$PATH:C:\Users\runneradmin\AppData\Roaming\uv\python" >> $GITHUB_ENV + echo "PYO3_PYTHON=$UV_PYTHON_PATH\python.exe" >> $GITHUB_ENV + - name: test - run: make test INSTALL_EXTRA=test + run: | + env + make test INSTALL_EXTRA=test shell: bash env: OPENSSL_DIR: "C:\\OpenSSL-Win64" From 54031ab4c5c1a134b3354bbdd48d9a29b5739a97 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 14:25:15 +0100 Subject: [PATCH 07/23] Test Signed-off-by: Alexis Signed-off-by: Alexis --- .github/workflows/tests.yml | 59 +++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5001aa8..ba1eff7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,35 +64,38 @@ jobs: - name: Install Python ${{ matrix.python }} run: uv python install ${{ matrix.python }} - - name: Install OpenSSL - env: - OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" - OPENSSL_PATH: "C:\\OpenSSL-Win64" - run: | - curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" - Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait - - - name: Setup rust - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 - with: - components: rustfmt - toolchain: 1.81.0 +# - name: Install OpenSSL +# env: +# OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" +# OPENSSL_PATH: "C:\\OpenSSL-Win64" +# run: | +# curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" +# Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait +# +# - name: Setup rust +# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 +# with: +# components: rustfmt +# toolchain: 1.81.0 - - name: Get env variables + - name: Setup env variables shell: bash run: | - UV_PYTHON_PATH="$(uv python dir)" - echo $UV_PYTHON_PATH - echo "PATH=$PATH:C:\Users\runneradmin\AppData\Roaming\uv\python" >> $GITHUB_ENV - echo "PYO3_PYTHON=$UV_PYTHON_PATH\python.exe" >> $GITHUB_ENV + UV_PYTHON_PATH=$(uv python dir) + export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" + echo "PATH=$PATH:$INSTALLED_PYTHON" >> $GITHUB_ENV + echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV + export PYO3_PYTHON="$INSTALLED_PYTHON\python.exe" + export PATH="$PATH:$INSTALLED_PYTHON" + cargo test --manifest-path rust/Cargo.toml - - name: test - run: | - env - make test INSTALL_EXTRA=test - shell: bash - env: - OPENSSL_DIR: "C:\\OpenSSL-Win64" - OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" - OPENSSL_NO_VENDOR: 1 - # PYO3_PYTHON: "$(uv python dir)\\python.exe" +# - name: test +# run: | +# env +# make test INSTALL_EXTRA=test +# shell: bash +# env: +# OPENSSL_DIR: "C:\\OpenSSL-Win64" +# OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" +# OPENSSL_NO_VENDOR: 1 +# # PYO3_PYTHON: "$(uv python dir)\\python.exe" From b4f329e292486bf41b3c4fa61d996054b109ff84 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 14:44:07 +0100 Subject: [PATCH 08/23] Test Signed-off-by: Alexis Signed-off-by: Alexis --- .github/workflows/tests.yml | 51 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba1eff7..2e62b47 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,38 +64,35 @@ jobs: - name: Install Python ${{ matrix.python }} run: uv python install ${{ matrix.python }} -# - name: Install OpenSSL -# env: -# OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" -# OPENSSL_PATH: "C:\\OpenSSL-Win64" -# run: | -# curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" -# Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait -# -# - name: Setup rust -# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 -# with: -# components: rustfmt -# toolchain: 1.81.0 + - name: Install OpenSSL + env: + OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" + OPENSSL_PATH: "C:\\OpenSSL-Win64" + run: | + curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" + Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait + + - name: Setup rust + uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 + with: + components: rustfmt + toolchain: 1.81.0 - name: Setup env variables shell: bash run: | UV_PYTHON_PATH=$(uv python dir) export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" - echo "PATH=$PATH:$INSTALLED_PYTHON" >> $GITHUB_ENV + echo "$INSTALLED_PYTHON" >> GITHUB_PATH echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - export PYO3_PYTHON="$INSTALLED_PYTHON\python.exe" - export PATH="$PATH:$INSTALLED_PYTHON" - cargo test --manifest-path rust/Cargo.toml -# - name: test -# run: | -# env -# make test INSTALL_EXTRA=test -# shell: bash -# env: -# OPENSSL_DIR: "C:\\OpenSSL-Win64" -# OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" -# OPENSSL_NO_VENDOR: 1 -# # PYO3_PYTHON: "$(uv python dir)\\python.exe" + - name: test + run: | + env + cargo test --manifest-path rust/Cargo.toml + # `make test INSTALL_EXTRA=test + shell: bash + env: + OPENSSL_DIR: "C:\\OpenSSL-Win64" + OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" + OPENSSL_NO_VENDOR: 1 From a0ebe883b9e2b8b677a6f17e88b2ab0b4c32e68b Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 14:52:28 +0100 Subject: [PATCH 09/23] Fix Test Signed-off-by: Alexis --- .github/workflows/tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2e62b47..7444110 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -87,10 +87,8 @@ jobs: echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - name: test - run: | - env - cargo test --manifest-path rust/Cargo.toml - # `make test INSTALL_EXTRA=test + run: | + make test INSTALL_EXTRA=test shell: bash env: OPENSSL_DIR: "C:\\OpenSSL-Win64" From 0e214e13e2a7d4cb8aa2b0f99380089277e72477 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 14:56:30 +0100 Subject: [PATCH 10/23] Restore Windows all versions tests Signed-off-by: Alexis --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7444110..5e3256d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,10 +45,10 @@ jobs: matrix: python: - "3.9" -# - "3.10" -# - "3.11" -# - "3.12" -# - "3.13" + - "3.10" + - "3.11" + - "3.12" + - "3.13" runs-on: windows-latest steps: From efdc8f0a54dfd458a26acc61a16c27112e9706c7 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 15:02:06 +0100 Subject: [PATCH 11/23] Check Python 3.12 Signed-off-by: Alexis --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5e3256d..531b194 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,11 +44,11 @@ jobs: strategy: matrix: python: - - "3.9" - - "3.10" - - "3.11" +# - "3.9" +# - "3.10" +# - "3.11" - "3.12" - - "3.13" +# - "3.13" runs-on: windows-latest steps: @@ -83,11 +83,11 @@ jobs: run: | UV_PYTHON_PATH=$(uv python dir) export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" - echo "$INSTALLED_PYTHON" >> GITHUB_PATH + echo "$INSTALLED_PYTHON" >> $GITHUB_PATH echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - name: test - run: | + run: | make test INSTALL_EXTRA=test shell: bash env: From 8fea7a01f336ede15fd788d9e081d86296b24172 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 16:49:40 +0100 Subject: [PATCH 12/23] Try another option Signed-off-by: Alexis --- .github/workflows/tests.yml | 18 ++++++++++-------- src/rfc3161_client/__init__.py | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 531b194..08dcd9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -78,17 +78,19 @@ jobs: components: rustfmt toolchain: 1.81.0 - - name: Setup env variables - shell: bash - run: | - UV_PYTHON_PATH=$(uv python dir) - export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" - echo "$INSTALLED_PYTHON" >> $GITHUB_PATH - echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV +# - name: Setup env variables +# shell: bash +# run: | +# UV_PYTHON_PATH=$(uv python dir) +# export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" +# echo "$INSTALLED_PYTHON" >> $GITHUB_PATH +# echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - name: test run: | - make test INSTALL_EXTRA=test + uv venv + . .venv/Scripts/activate && uv pip install -e . && python -c "import rfc3161_client" + # make test INSTALL_EXTRA=test shell: bash env: OPENSSL_DIR: "C:\\OpenSSL-Win64" diff --git a/src/rfc3161_client/__init__.py b/src/rfc3161_client/__init__.py index 351db8b..3a76fff 100644 --- a/src/rfc3161_client/__init__.py +++ b/src/rfc3161_client/__init__.py @@ -1,4 +1,22 @@ """rfc3161-client""" +import os +import platform +import sys +from pathlib import Path + +def add_missing_dlls(): + print(f'ADD MISSING DIR {platform.system()}') + if platform.system() != "Windows": + return + + print(f"Adding directories to DLL directory") + if openssl_dir := os.environ.get("OPENSSL_DIR"): + os.add_dll_directory(openssl_dir) + + python_dir = Path(sys.executable).parent + os.add_dll_directory(python_dir.as_posix()) + +add_missing_dlls() from .base import TimestampRequestBuilder, decode_timestamp_response from .errors import VerificationError From 6200f1cb510ae9fadc55e804f878243ad724b16c Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 17:10:44 +0100 Subject: [PATCH 13/23] Try another option Signed-off-by: Alexis --- .github/workflows/tests.yml | 2 +- src/rfc3161_client/__init__.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08dcd9c..4249767 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -89,7 +89,7 @@ jobs: - name: test run: | uv venv - . .venv/Scripts/activate && uv pip install -e . && python -c "import rfc3161_client" + . .venv/Scripts/activate && uv pip install -n -e '.[test]' && pytest --cov=rfc3161_client # make test INSTALL_EXTRA=test shell: bash env: diff --git a/src/rfc3161_client/__init__.py b/src/rfc3161_client/__init__.py index 3a76fff..7d8bda0 100644 --- a/src/rfc3161_client/__init__.py +++ b/src/rfc3161_client/__init__.py @@ -5,11 +5,18 @@ from pathlib import Path def add_missing_dlls(): - print(f'ADD MISSING DIR {platform.system()}') + """Add required DLL search directories for Windows platform. + + This function ensures DLLs can be found by: + 1. Adding OpenSSL directory from OPENSSL_DIR environment variable (if set) + 2. Adding Python installation directory + + These directories are only added on Windows platforms. On other platforms, + the function returns without making any changes. + """ if platform.system() != "Windows": return - print(f"Adding directories to DLL directory") if openssl_dir := os.environ.get("OPENSSL_DIR"): os.add_dll_directory(openssl_dir) From 12fb4b5e5025e478ef562967a71b0f9d4bb48cc1 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 4 Nov 2024 17:42:00 +0100 Subject: [PATCH 14/23] Another solution to not use the cache Signed-off-by: Alexis --- .github/workflows/tests.yml | 21 ++++++++++++--------- src/rfc3161_client/__init__.py | 7 +++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4249767..ffe7fc9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -78,21 +78,24 @@ jobs: components: rustfmt toolchain: 1.81.0 -# - name: Setup env variables -# shell: bash -# run: | -# UV_PYTHON_PATH=$(uv python dir) -# export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" -# echo "$INSTALLED_PYTHON" >> $GITHUB_PATH -# echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV + - name: Setup env variables + shell: bash + run: | + UV_PYTHON_PATH=$(uv python dir) + export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" + # echo "$INSTALLED_PYTHON" >> $GITHUB_PATH + echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - name: test run: | - uv venv - . .venv/Scripts/activate && uv pip install -n -e '.[test]' && pytest --cov=rfc3161_client + $PYO3_PYTHON -m venv env-local + . env-local/Scripts/activate + pip install -e '.[test]' + pytest --cov=rfc3161_client # make test INSTALL_EXTRA=test shell: bash env: OPENSSL_DIR: "C:\\OpenSSL-Win64" OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" OPENSSL_NO_VENDOR: 1 + UV_NO_CACHE: true diff --git a/src/rfc3161_client/__init__.py b/src/rfc3161_client/__init__.py index 7d8bda0..ead1383 100644 --- a/src/rfc3161_client/__init__.py +++ b/src/rfc3161_client/__init__.py @@ -19,9 +19,12 @@ def add_missing_dlls(): if openssl_dir := os.environ.get("OPENSSL_DIR"): os.add_dll_directory(openssl_dir) + print(f"Dlls : {list(Path(openssl_dir).glob('*.dll'))}") - python_dir = Path(sys.executable).parent - os.add_dll_directory(python_dir.as_posix()) + if pyo3_python := os.environ.get("PYO3_PYTHON"): + python_dir = Path(pyo3_python).parent + print(f"Dlls ({python_dir}) : {list(Path(python_dir).glob('*.dll'))}") + os.add_dll_directory(python_dir.as_posix()) add_missing_dlls() From 57e977c2fd93fe8ca1612dbfc2eb1e11f9119090 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 09:40:41 +0100 Subject: [PATCH 15/23] Use dlltracer in CI Signed-off-by: Alexis --- .github/workflows/tests.yml | 41 +++++++++++++++++++--------------- main.py | 20 +++++++++++++++++ src/rfc3161_client/__init__.py | 2 +- 3 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 main.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ffe7fc9..032a0c6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,6 +53,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Install the latest version of uv uses: astral-sh/setup-uv@v3 @@ -72,11 +74,11 @@ jobs: curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait - - name: Setup rust - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 - with: - components: rustfmt - toolchain: 1.81.0 +# - name: Setup rust +# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 +# with: +# components: rustfmt +# toolchain: 1.81.0 - name: Setup env variables shell: bash @@ -86,16 +88,19 @@ jobs: # echo "$INSTALLED_PYTHON" >> $GITHUB_PATH echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV - - name: test - run: | - $PYO3_PYTHON -m venv env-local - . env-local/Scripts/activate - pip install -e '.[test]' - pytest --cov=rfc3161_client - # make test INSTALL_EXTRA=test - shell: bash - env: - OPENSSL_DIR: "C:\\OpenSSL-Win64" - OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" - OPENSSL_NO_VENDOR: 1 - UV_NO_CACHE: true + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + +# - name: test +# run: | +# uv venv env-local +# . env-local/Scripts/activate +# uv pip install dlltracer +# uv pip install -e '.[test]' +# python main.py +# # make test INSTALL_EXTRA=test +# shell: bash +# env: +# OPENSSL_DIR: "C:\\OpenSSL-Win64" +# OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" +# OPENSSL_NO_VENDOR: 1 diff --git a/main.py b/main.py new file mode 100644 index 0000000..eb134bc --- /dev/null +++ b/main.py @@ -0,0 +1,20 @@ +import sys +import os +from pathlib import Path + +import dlltracer + + +def add_dll(): + if openssl_dir := os.environ.get("OPENSSL_DIR"): + os.add_dll_directory(openssl_dir) + print(f"Dlls : {list(Path(openssl_dir).glob('*.dll'))}") + + if pyo3_python := os.environ.get("PYO3_PYTHON"): + python_dir = Path(pyo3_python).parent + print(f"Dlls ({python_dir}) : {list(Path(python_dir).glob('*.dll'))}") + os.add_dll_directory(python_dir.as_posix()) + + +with dlltracer.Trace(out=sys.stdout): + import rfc3161_client \ No newline at end of file diff --git a/src/rfc3161_client/__init__.py b/src/rfc3161_client/__init__.py index ead1383..3de06bb 100644 --- a/src/rfc3161_client/__init__.py +++ b/src/rfc3161_client/__init__.py @@ -26,7 +26,7 @@ def add_missing_dlls(): print(f"Dlls ({python_dir}) : {list(Path(python_dir).glob('*.dll'))}") os.add_dll_directory(python_dir.as_posix()) -add_missing_dlls() +# add_missing_dlls() from .base import TimestampRequestBuilder, decode_timestamp_response from .errors import VerificationError From 07bb76ff48b191d93427f634ed3f1b50b2a53cf4 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 11:26:44 +0100 Subject: [PATCH 16/23] Change OpenSSL installation version Signed-off-by: Alexis --- .github/workflows/tests.yml | 46 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 032a0c6..0b66481 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,6 +43,8 @@ jobs: test-windows: strategy: matrix: + windows: + - 'win64' python: # - "3.9" # - "3.10" @@ -66,13 +68,15 @@ jobs: - name: Install Python ${{ matrix.python }} run: uv python install ${{ matrix.python }} - - name: Install OpenSSL - env: - OPENSSL_INSTALLER: "Win64OpenSSL-3_3_2.exe" - OPENSSL_PATH: "C:\\OpenSSL-Win64" - run: | - curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" - Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait + - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 + with: + repo: pyca/infra + workflow: build-windows-openssl.yml + branch: main + workflow_conclusion: success + name: "openssl-${{ matrix.windows }}" + path: "C:/openssl-${{ matrix.windows }}/" + github_token: ${{ secrets.GITHUB_TOKEN }} # - name: Setup rust # uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 @@ -80,27 +84,17 @@ jobs: # components: rustfmt # toolchain: 1.81.0 - - name: Setup env variables + - name: Configure shell: bash run: | - UV_PYTHON_PATH=$(uv python dir) - export INSTALLED_PYTHON="$(find $UV_PYTHON_PATH -type d -maxdepth 1 -name '*${{ matrix.python }}*')" - # echo "$INSTALLED_PYTHON" >> $GITHUB_PATH - echo "PYO3_PYTHON=$INSTALLED_PYTHON\python.exe" >> $GITHUB_ENV + echo "OPENSSL_DIR=C:/openssl-${{ matrix.windows }}" >> $GITHUB_ENV + echo "OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV + + - name: test + run: | + make test INSTALL_EXTRA=test + shell: bash - name: Setup tmate session uses: mxschmitt/action-tmate@v3 - -# - name: test -# run: | -# uv venv env-local -# . env-local/Scripts/activate -# uv pip install dlltracer -# uv pip install -e '.[test]' -# python main.py -# # make test INSTALL_EXTRA=test -# shell: bash -# env: -# OPENSSL_DIR: "C:\\OpenSSL-Win64" -# OPENSSL_LIB_DIR: "C:\\OpenSSL-Win64\\lib\\VC\\x64\\MD" -# OPENSSL_NO_VENDOR: 1 + if: ${{ failure() }} \ No newline at end of file From b39694e8fdc8e8cad5c5a3b7f98a6bcee45f81e2 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 11:43:11 +0100 Subject: [PATCH 17/23] Enable other Python version Signed-off-by: Alexis --- .github/workflows/tests.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0b66481..39b81b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,11 +46,11 @@ jobs: windows: - 'win64' python: -# - "3.9" -# - "3.10" -# - "3.11" + - "3.9" + - "3.10" + - "3.11" - "3.12" -# - "3.13" + - "3.13" runs-on: windows-latest steps: @@ -78,12 +78,6 @@ jobs: path: "C:/openssl-${{ matrix.windows }}/" github_token: ${{ secrets.GITHUB_TOKEN }} -# - name: Setup rust -# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 -# with: -# components: rustfmt -# toolchain: 1.81.0 - - name: Configure shell: bash run: | From 3ca15a6bbd906a887375e20b0c9c8615b1db6f7e Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 11:50:47 +0100 Subject: [PATCH 18/23] Enable other platforms Signed-off-by: Alexis --- .github/workflows/tests.yml | 67 ++++++++++++++++------------------ src/rfc3161_client/__init__.py | 28 -------------- 2 files changed, 31 insertions(+), 64 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39b81b7..5cc1c89 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,38 +7,37 @@ on: pull_request: jobs: -# test-ubuntu: -# strategy: -# matrix: -# python: -# - "3.9" -# - "3.10" -# - "3.11" -# - "3.12" -# - "3.13" -# -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# -# - name: Install the latest version of uv -# uses: astral-sh/setup-uv@v3 -# with: -# version: "0.4.18" -# enable-cache: true -# cache-dependency-glob: pyproject.toml -# -# - name: Install Python ${{ matrix.python }} -# run: uv python install ${{ matrix.python }} -# -# - name: Setup rust -# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 -# with: -# components: rustfmt -# toolchain: 1.81.0 -# -# - name: test -# run: make test INSTALL_EXTRA=test + test-ubuntu-macos: + strategy: + matrix: + platform: + - macos-latest + - ubuntu-latest + python: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.18" + enable-cache: true + cache-dependency-glob: pyproject.toml + + - name: Install Python ${{ matrix.python }} + run: uv python install ${{ matrix.python }} + + - name: test + run: make test INSTALL_EXTRA=test test-windows: strategy: @@ -88,7 +87,3 @@ jobs: run: | make test INSTALL_EXTRA=test shell: bash - - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - if: ${{ failure() }} \ No newline at end of file diff --git a/src/rfc3161_client/__init__.py b/src/rfc3161_client/__init__.py index 3de06bb..351db8b 100644 --- a/src/rfc3161_client/__init__.py +++ b/src/rfc3161_client/__init__.py @@ -1,32 +1,4 @@ """rfc3161-client""" -import os -import platform -import sys -from pathlib import Path - -def add_missing_dlls(): - """Add required DLL search directories for Windows platform. - - This function ensures DLLs can be found by: - 1. Adding OpenSSL directory from OPENSSL_DIR environment variable (if set) - 2. Adding Python installation directory - - These directories are only added on Windows platforms. On other platforms, - the function returns without making any changes. - """ - if platform.system() != "Windows": - return - - if openssl_dir := os.environ.get("OPENSSL_DIR"): - os.add_dll_directory(openssl_dir) - print(f"Dlls : {list(Path(openssl_dir).glob('*.dll'))}") - - if pyo3_python := os.environ.get("PYO3_PYTHON"): - python_dir = Path(pyo3_python).parent - print(f"Dlls ({python_dir}) : {list(Path(python_dir).glob('*.dll'))}") - os.add_dll_directory(python_dir.as_posix()) - -# add_missing_dlls() from .base import TimestampRequestBuilder, decode_timestamp_response from .errors import VerificationError From d9fb1024096d4d50e049202a648451151e266952 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 11:53:31 +0100 Subject: [PATCH 19/23] Delete debug file Signed-off-by: Alexis --- main.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 main.py diff --git a/main.py b/main.py deleted file mode 100644 index eb134bc..0000000 --- a/main.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import os -from pathlib import Path - -import dlltracer - - -def add_dll(): - if openssl_dir := os.environ.get("OPENSSL_DIR"): - os.add_dll_directory(openssl_dir) - print(f"Dlls : {list(Path(openssl_dir).glob('*.dll'))}") - - if pyo3_python := os.environ.get("PYO3_PYTHON"): - python_dir = Path(pyo3_python).parent - print(f"Dlls ({python_dir}) : {list(Path(python_dir).glob('*.dll'))}") - os.add_dll_directory(python_dir.as_posix()) - - -with dlltracer.Trace(out=sys.stdout): - import rfc3161_client \ No newline at end of file From 27430bb611d68ec4e3c0c17b9a5a3a5f540cf5b4 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 15:53:56 +0100 Subject: [PATCH 20/23] Remove vendored features in `openssl` Signed-off-by: Alexis --- rust/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 7b3e05f..ff9a811 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -21,7 +21,7 @@ hex = "0.4" sha2 = "0.10.8" rand = "0.8.5" cryptography-x509 = { git = "https://github.com/pyca/cryptography.git"} -openssl = { version = "0.10.68", features = ["vendored"] } +openssl = "0.10.68" [features] extension-module = ["pyo3/extension-module"] From 9d4d7cc79f47b9233e7c39d5f751879113c141cc Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 15:57:54 +0100 Subject: [PATCH 21/23] Remove vendored features in `openssl` Signed-off-by: Alexis --- rust/Cargo.lock | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 3f3b745..560ff6a 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -202,15 +202,6 @@ dependencies = [ "syn", ] -[[package]] -name = "openssl-src" -version = "300.3.2+3.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.104" @@ -219,7 +210,6 @@ checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] From 471704102497b0e1f147cd275ff6cf30a1ff1bc9 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 5 Nov 2024 16:10:56 +0100 Subject: [PATCH 22/23] Revert change to vendored Signed-off-by: Alexis --- rust/Cargo.lock | 10 ++++++++++ rust/Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 560ff6a..40b52f5 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -202,6 +202,15 @@ dependencies = [ "syn", ] +[[package]] +name = "openssl-src" +version = "300.4.0+3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.104" @@ -210,6 +219,7 @@ checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 98085a9..6acdc4f 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -21,7 +21,7 @@ hex = "0.4" sha2 = "0.10.8" rand = "0.8.5" cryptography-x509 = { git = "https://github.com/pyca/cryptography.git", rev = "a63ca251a7aa8a5aac6153e0b69083cb05e1a6d0" } -openssl = "0.10.68" +openssl = { version = "0.10.68", features = ["vendored"] } [features] extension-module = ["pyo3/extension-module"] From 7fcc5aabef021216b30f6794af96c31b426b1105 Mon Sep 17 00:00:00 2001 From: dm Date: Wed, 6 Nov 2024 15:14:59 +0100 Subject: [PATCH 23/23] Dm/test windows dep (#56) Signed-off-by: Alexis --- .github/workflows/CI.yml | 126 +++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 50 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 769c1a6..7686bfa 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,27 @@ permissions: contents: read jobs: + sdist: + runs-on: ubuntu-latest + name: sdists + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.18" + enable-cache: true + cache-dependency-glob: pyproject.toml + - name: Make sdist (rfc3161_client) + run: uv build --sdist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: rfc3161-sdist + path: dist/rfc3161_client* + linux: runs-on: ubuntu-latest strategy: @@ -82,49 +103,71 @@ jobs: path: dist windows: - runs-on: ${{ matrix.platform.runner }} + needs: [sdist] + runs-on: windows-latest strategy: + fail-fast: false matrix: - platform: - - runner: windows-latest - arch: 64 - target: x64 - - runner: windows-latest - arch: 32 - target: x86 + WINDOWS: + - {ARCH: 'x86', WINDOWS: 'win32', RUST_TRIPLE: 'i686-pc-windows-msvc'} + - {ARCH: 'x64', WINDOWS: 'win64', RUST_TRIPLE: 'x86_64-pc-windows-msvc'} + name: ${{ matrix.WINDOWS.WINDOWS }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + with: + persist-credentials: false + - uses: actions/download-artifact@v4.1.8 + with: + name: rfc3161-sdist + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.18" + enable-cache: true + cache-dependency-glob: pyproject.toml + # We cannot use `uv python install` because it doesn't allow to install python + # version for another architecture + - name: Setup python + uses: actions/setup-python@v5.3.0 with: python-version: 3.x - architecture: ${{ matrix.platform.target }} - - name: Install OpenSSL - env: - OPENSSL_INSTALLER: "Win${{ matrix.platform.arch }}OpenSSL-3_3_2.exe" - OPENSSL_PATH: "C:\\OpenSSL-Win${{ matrix.platform.arch }}" + architecture: ${{ matrix.WINDOWS.ARCH }} + - uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 + with: + toolchain: stable + target: ${{ matrix.WINDOWS.RUST_TRIPLE }} + - uses: dawidd6/action-download-artifact@v6 + with: + repo: pyca/infra + workflow: build-windows-openssl.yml + branch: main + workflow_conclusion: success + name: "openssl-${{ matrix.WINDOWS.WINDOWS }}" + path: "C:/openssl-${{ matrix.WINDOWS.WINDOWS }}/" + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Configure OpenSSL run: | - curl.exe -o "c:\\${env:OPENSSL_INSTALLER}" -fsSL "https://slproweb.com/download/${env:OPENSSL_INSTALLER}" - Start-Process -FilePath "c:\\${env:OPENSSL_INSTALLER}" -ArgumentList "/silent /verysilent /DIR=${env:OPENSSL_PATH}" -NoNewWindow -Wait - echo "Installed OpenSSL version:" - Start-Process -FilePath "${env:OPENSSL_PATH}\\bin\\openssl.exe" -ArgumentList "version" -Wait -NoNewWindow - echo "Folder contents:" - ls ${env:OPENSSL_PATH} -Recurse - - name: Build wheels - uses: PyO3/maturin-action@v1 - env: - OPENSSL_DIR: "C:\\OpenSSL-Win${{ matrix.platform.arch }}" - OPENSSL_LIB_DIR: "C:\\OpenSSL-Win${{ matrix.platform.arch }}\\lib\\VC\\${{ matrix.platform.target }}\\MD" - # Do not build OpenSSL on Windows, since we are installing it - OPENSSL_NO_VENDOR: 1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter - sccache: 'true' + echo "OPENSSL_DIR=C:/openssl-${{ matrix.WINDOWS.WINDOWS }}" >> $GITHUB_ENV + echo "OPENSSL_STATIC=1" >> $GITHUB_ENV + echo "OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV + shell: bash + - run: mkdir wheelhouse + - name: Build wheel + run: | + uv build --wheel rfc3161*.tar.gz -o wheelhouse/ + shell: bash + - name: Test Install + run: | + uv venv + source ./.venv/Scripts/activate + uv pip install wheelhouse/rfc3161_client*.whl + python -c "import rfc3161_client" + shell: bash - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-windows-${{ matrix.platform.target }} - path: dist + name: "wheels-windows-${{ matrix.WINDOWS.ARCH }}" + path: wheelhouse macos: runs-on: ${{ matrix.platform.runner }} @@ -156,23 +199,6 @@ jobs: name: wheels-macos-${{ matrix.platform.target }} path: dist - sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: wheels-sdist - path: dist publish: name: Publish Python distributions to PyPI