Skip to content

cicd test

cicd test #4

Workflow file for this run

name: Build Python Package
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
push:
branches: [ main ]
# Trigger the workflow on any pull request
# pull_request:
jobs:
# build-tarball:
# permissions:
# contents: read # to fetch code (actions/checkout)
#
# name: Tarball
# runs-on: ubuntu-latest
## needs: pre-deploy
# defaults:
# run:
# working-directory: ./python
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: true
# - name: Setup Python
# uses: actions/setup-python@v5
# - name: Update pip, wheel, setuptools, build, twine
# run: |
# sudo apt-get update && sudo apt-get install libssl-dev
# echo "OPENSSL_INCLUDE_DIR=/usr/include/openssl" >> $GITHUB_ENV
# echo "OPENSSL_LIBRARY_DIR=$(dpkg -L libssl-dev | grep -m 1 libcrypto | xargs dirname)" >> $GITHUB_ENV
# python -m pip install -U pip wheel setuptools build twine
# - name: Make sdist
# run: |
# python -m build --sdist
# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: dist
# path: ./python/dist
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, macos-13, macos-14, ubuntu-latest ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache openssl for windows
if: matrix.os == 'windows-latest'
id: cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/python/openssl/
key: openssl-cache-for-windows
- name: Install Openssl On Windows
if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit != 'true'
run: |
choco upgrade --no-progress -y chocolatey -version 1.4.0 --allow-downgrade &&
choco install --no-progress -y openssl &&
cp -r "C:\\Program Files\\OpenSSL" ./python/openssl/x86_64 &&
choco install --no-progress --allow-multiple -y --forceX86 --version 1.1.1.2100 openssl &&
cp -r "C:\\Program Files (x86)\\OpenSSL-Win32" ./python/openssl/x86
- name: Set openssl for macos
if: contains(matrix.os, 'macos')
run: echo "OPENSSL_ROOT=$(brew --prefix openssl@3)" >> $GITHUB_ENV
- name: Update pip, wheel, setuptools, build, twine, cibuildwheel
run: |
python -m pip install -U pip wheel setuptools build twine cibuildwheel
# Fucking cibuildwheel doesn't contain a real cross-compilation toolchain, at least Linux requires qemu
- name: Build wheels
run: |
cd ./python &&
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BEFORE_BUILD_WINDOWS: |
set PYTHON_ARCH=%PYTHON_ARCH%
if "%PYTHON_ARCH%"=="32" (
echo Setting environment variables for x86 architecture
setx OPENSSL_INCLUDE_DIR=./openssl/x86/include
setx OPENSSL_LIBRARY_DIR=./openssl/x86/lib/VC/static
setx OPENSSL_LIBRARIES=libcrypto64MT Crypt32 ws2_32 Advapi32 User32
) else (
echo Setting environment variables for x86_64 architecture
setx OPENSSL_INCLUDE_DIR=./openssl/x86_64/include
setx OPENSSL_LIBRARY_DIR=./openssl/x86_64/lib/VC/static
setx OPENSSL_LIBRARIES=libcrypto32MT Crypt32 ws2_32 Advapi32 User32
)
CIBW_BEFORE_ALL_LINUX: >
yum update -y &&
yum install -y openssl-devel
CIBW_ENVIRONMENT_LINUX: >
OPENSSL_INCLUDE_DIR=/usr/include
OPENSSL_LIBRARIES=crypto
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair -w {dest_dir} {wheel}"
CIBW_ENVIRONMENT_MACOS: >
SYSTEM_VERSION_COMPAT=0
OPENSSL_INCLUDE_DIR=${{ env.OPENSSL_ROOT }}/include
OPENSSL_LIBRARY_DIR=${{ env.OPENSSL_ROOT }}/lib
LD_LIBRARY_PATH=${{ env.OPENSSL_ROOT }}/lib
CIBW_TEST_COMMAND: python {project}/tests/test.py
- uses: actions/upload-artifact@v3
with:
name: dist
path: ./python/wheelhouse/*.whl
# deploy:
# name: Deploy
# needs: [ build-tarball, build-wheels ]
# runs-on: ubuntu-latest
# permissions:
# contents: write # IMPORTANT: mandatory for making GitHub Releases
# id-token: write # IMPORTANT: mandatory for trusted publishing & sigstore
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: true
# - name: Login
# run: |
# echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
# - name: Download distributions
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: ./python/dist
# - name: Collected dists
# run: |
# tree dist
#
## - name: Upload artifact signatures to GitHub Release
# # Confusingly, this action also supports updating releases, not
# # just creating them. This is what we want here, since we've manually
# # created the release above.
# uses: softprops/action-gh-release@v2
# with:
# # dist/ contains the built packages, which smoketest-artifacts/
# # contains the signatures and certificates.
# files: ./dist/**