Skip to content
119 changes: 69 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
generator: Unix Makefiles
vcpkg_root:
- id: macOS
triplet: x64-osx
triplet: arm64-osx
compiler: clang
os: macOS-latest
generator: Unix Makefiles
Expand Down Expand Up @@ -107,17 +107,23 @@ jobs:
if: matrix.compiler == 'mingw'
run: echo "D:/a/_temp/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install apt dependencies (Linux)
if: runner.os == 'Linux'
- name: Set up Python (macOS)
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: '3.13'
update-environment: false
architecture: 'arm64'

- name: Set up Python virtual environment (Linux/macOS)
if: runner.os != 'Windows'
run: |
sudo apt-get update
sudo apt-get remove needrestart || echo Ignored
sudo apt-get install -y libssl-dev zlib1g-dev python3-cryptography
python -m venv --system-site-packages --copies venv

- name: Install brew dependencies (macOS)
if: runner.os == 'macOS'
- name: Set up Python virtual environment (Windows)
if: runner.os == 'Windows'
run: |
brew install python@3.8
python.exe -m venv --system-site-packages --copies venv

- name: Install Xcode (macOS)
if: runner.os == 'macOS'
Expand All @@ -128,63 +134,66 @@ jobs:
- name: Setup the oldest supported version of cmake (macOS)
if: runner.os == 'macOS'
uses: jwlawson/actions-setup-cmake@v2.0
with:
cmake-version: '3.17.0'

- name: Install python3 cryptography module (macOS)
if: runner.os == 'macOS'
- name: Install python3 cryptography module (Linux)
if: runner.os == 'Linux'
run: |
python3.8 -m ensurepip
python3.8 -m pip install --upgrade pip
python3.8 -m pip install cryptography
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --upgrade cryptography
python -c "import sys; print(sys.executable)"
python --version
python -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"

- name: Find the latest version of Python (Windows)
if: runner.os == 'Windows'
- name: Install python3 cryptography module (macOS)
if: runner.os == 'macOS'
run: |
$pythonVersions = Get-ChildItem -Path "C:/hostedtoolcache/windows/Python/" -Directory | Where-Object { $_.Name -match '\d+\.\d+\.\d+' } | Sort-Object { [Version]($_.Name) } -Descending
if ($pythonVersions.Count -gt 0) {
$latestPythonVersion = $pythonVersions[0].Name
$pythonPath = "C:/hostedtoolcache/windows/Python/$latestPythonVersion/x64"
Write-Output "Latest Python version found: $latestPythonVersion"
Write-Output "Python directory path: $pythonPath"
$env:Path = "$pythonPath;" + $env:Path
Write-Output "Updated PATH environment variable:"
Write-Output $env:Path
} else {
Write-Error "No Python versions found in C:/hostedtoolcache/windows/Python/"
exit 1
}
source venv/bin/activate
python -m pip install --upgrade pip
ARCHFLAGS="-arch arm64" python -m pip install --upgrade cryptography
python -c "import sys; print(sys.executable)"
python --version
python -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"

- name: Install python3 cryptography module (Windows)
if: runner.os == 'Windows'
run: |
.\venv\Scripts\Activate.ps1
python.exe -m ensurepip
python.exe -m pip install --upgrade pip
python.exe -m pip install cryptography
python.exe -c "import sys; print(sys.executable)"
python.exe --version
python.exe -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"

- name: Configure CMake
run: cmake
-G "${{matrix.generator}}"
-S ${{github.workspace}}
-B ${{github.workspace}}/build
-DCMAKE_OSX_ARCHITECTURES=arm64
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist
-DVCPKG_TARGET_TRIPLET=${{matrix.triplet}}
- name: Configure CMake (Linux/macOS)
if: runner.os != 'Windows'
run: |
source venv/bin/activate
cmake \
-G "${{matrix.generator}}" \
-S "${{github.workspace}}" \
-B "${{github.workspace}}/build" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" \
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/dist"

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: |
.\venv\Scripts\Activate.ps1
cmake `
-G "${{matrix.generator}}" `
-S "${{github.workspace}}" `
-B "${{github.workspace}}/build" `
-DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" `
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/dist"

- name: Build
run: cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}

- name: Show python version (macOS)
working-directory: ${{github.workspace}}/build
if: runner.os == 'macOS'
run: |
python3.8 --version
python3.8 -c "import sys; print(sys.executable)"
python3.8 -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"

- name: List files (Linux/macOS)
if: runner.os != 'Windows'
run: find .. -ls
Expand All @@ -193,9 +202,19 @@ jobs:
if: runner.os == 'Windows'
run: Get-ChildItem -Recurse -Name ..

- name: Test
- name: Test (Linux/macOS)
if: runner.os != 'Windows'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
run: |
source ../venv/bin/activate
ctest -C ${{env.BUILD_TYPE}}

- name: Test (Windows)
if: runner.os == 'Windows'
working-directory: ${{github.workspace}}/build
run: |
..\venv\Scripts\Activate.ps1
ctest -C ${{env.BUILD_TYPE}}

- name: Upload the errors
uses: actions/upload-artifact@v4
Expand Down
Loading