Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on Windows and MacOS #49

Merged
merged 26 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 76 additions & 50 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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/[email protected]
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/[email protected]
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 }}
Expand Down Expand Up @@ -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
Expand Down
63 changes: 56 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,55 @@ on:
pull_request:

jobs:
test:
test-ubuntu-macos:
strategy:
matrix:
platform:
- macos-latest
- ubuntu-latest
python:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-latest

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:
matrix:
windows:
- 'win64'
python:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

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
Expand All @@ -30,11 +67,23 @@ jobs:
- name: Install Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}

- name: Setup rust
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8
- uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
components: rustfmt
toolchain: 1.81.0
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: Configure
shell: bash
run: |
echo "OPENSSL_DIR=C:/openssl-${{ matrix.windows }}" >> $GITHUB_ENV
echo "OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV

- name: test
run: make test INSTALL_EXTRA=test
run: |
make test INSTALL_EXTRA=test
shell: bash
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 0 additions & 81 deletions rust/tsp-asn1/Cargo.lock

This file was deleted.

Loading