Skip to content

Add warning not to depend on pycddlib-standalone. See https://github.… #246

Add warning not to depend on pycddlib-standalone. See https://github.…

Add warning not to depend on pycddlib-standalone. See https://github.… #246

Workflow file for this run

name: build
on:
push:
branches: [ develop ]
tags: ['**']
pull_request:
branches: [ develop ]
env:
VCPKG_HASH: '8bec3bc4105dc7839930a919baeb922ba76d695c'
jobs:
build-sdist:
runs-on: 'ubuntu-latest'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: actions/checkout@v4
- name: Create sdist
run: |
python -m pip install build
python -m build -s
- name: Check sdist
run: |
python -m pip install twine
twine check dist/*
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*
if-no-files-found: error
test-ubuntu-macos:
runs-on: ${{ matrix.os }}
needs: build-sdist
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cddlib (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y libcdd-dev libgmp-dev
- name: Install cddlib (MacOS)
if: matrix.os == 'macos-latest'
run: brew install cddlib gmp
- name: Install Python dependencies
run: python -m pip install setuptools Cython Sphinx pytest wheel numpy mypy
- name: Install tarball (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: python -m pip install $(ls dist/*.tar.gz | head -1)
- name: Install tarball (MacOS)
if: matrix.os == 'macos-latest'
run: env "CFLAGS=-I$(brew --prefix)/include -L$(brew --prefix)/lib" python -m pip install $(ls dist/*.tar.gz | head -1)
- uses: actions/checkout@v4
- name: Run test suite
run: |
mypy
pytest
cd docs
make doctest
build-vcpkg:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest']
steps:
- uses: actions/cache@v4
id: vcpkg-installed-cache
with:
path: installed/
key: vcpkg-0-${{ env.VCPKG_HASH }}-${{ matrix.os }}
- uses: actions/checkout@v4
if: steps.vcpkg-installed-cache.outputs.cache-hit != 'true'
with:
repository: mcmtroffaes/vcpkg
ref: ${{ env.VCPKG_HASH }}
- name: Install cddlib (Windows)
if: steps.vcpkg-installed-cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
run: |
./bootstrap-vcpkg.bat -disableMetrics
./vcpkg.exe install cddlib:x64-windows-static-md-release
ls -R installed/x64-windows-static-md-release/include/
ls -R installed/x64-windows-static-md-release/lib/
- name: Install cddlib (Ubuntu/MacOs)
if: steps.vcpkg-installed-cache.outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
run: |
sudo apt-get install -y autoconf-archive
./bootstrap-vcpkg.sh -disableMetrics
./vcpkg install cddlib:x64-linux
ls -R installed/x64-linux/include/
ls -R installed/x64-linux/lib/
- name: Upload vcpkg
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.os }}
path: installed/
if-no-files-found: error
build-test-vcpkg:
runs-on: ${{ matrix.os }}
needs: build-vcpkg
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Download vcpkg
uses: actions/download-artifact@v4
with:
name: vcpkg-x64-${{ matrix.os }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Check Python environment (Windows)
if: matrix.os == 'windows-latest'
run: |
ls -R x64-windows-static-md-release/include/
ls -R x64-windows-static-md-release/lib/
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"
- name: Check Python environment (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
ls -R x64-linux/include/
ls -R x64-linux/lib/
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"
- name: Install Python dependencies
run: python -m pip install Sphinx pytest numpy twine wheel build mypy
- name: Create wheel (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m build -w -C="--global-option=build_ext" -C="--global-option=-Ix64-windows-static-md-release/include/" -C="--global-option=-Lx64-windows-static-md-release/lib/"
- name: Create wheel (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
python -m build -w -C="--global-option=build_ext" -C="--global-option=-Ix64-linux/include/" -C="--global-option=-Lx64-linux/lib/"
- name: Check wheel (Windows)
if: matrix.os == 'windows-latest'
run: |
twine check dist/*
wheel unpack ((Get-ChildItem -Path dist/ -Filter *.whl)[0].FullName) --dest wheel
ls -R wheel/
If (((Get-ChildItem -Path wheel/ -Recurse -Include ("*.pyx", "*.pxi", "*.c"))).Length -Ne 0) {
throw "Wheel contains .pyx, .pxi, or .c files."
}
- name: Upload wheel (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-wheels-${{ matrix.python-version }}
path: dist/*
if-no-files-found: error
- name: Install wheel (Windows)
if: matrix.os == 'windows-latest'
run: pip install ((Get-ChildItem -Path dist/ -Filter *.whl)[0].FullName)
- name: Install wheel (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: pip install $(ls dist/*.whl | head -1)
- name: Run test suite
run: |
mypy
pytest
cd docs
make doctest
release:
if: github.repository == 'mcmtroffaes/pycddlib'
runs-on: 'ubuntu-latest'
permissions:
id-token: write
needs: [ build-sdist, test-ubuntu-macos, build-test-vcpkg ]
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: windows-wheels-*
path: dist/
merge-multiple: true
- name: List files
run: ls -R dist/
- name: Publish to Test PyPI
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1