Quick fix for slider bug in interactive viewers #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Build and deploy | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the master/develop branches | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' # run on semantic version tags | |
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # pre-release | |
pull_request: | |
branches: | |
- master | |
- develop | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-wheels: | |
name: ${{ matrix.os }} build and test wheels | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: windows-latest | |
triplet: x64-windows | |
builddir: dist | |
- os: ubuntu-latest | |
triplet: x64-linux | |
builddir: wheelhouse | |
- os: macos-latest | |
triplet: x64-osx | |
builddir: wheelhouse | |
env: | |
# Indicates the CMake build directory where project files and binaries are being produced. | |
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/ | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg | |
CIBW_ENVIRONMENT_WINDOWS: EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake -DVCPKG_MANIFEST_DIR=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\" | |
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-*" | |
CIBW_SKIP: "*musllinux*" | |
CIBW_ARCHS: "auto64" | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip install -U delocate && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "pip install -U wheel delvewheel && python fix_windows_wheel.py {wheel} {dest_dir}" | |
CIBW_TEST_REQUIRES: "pytest pytest-qt pytest-xvfb" | |
CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" | |
CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately | |
CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" | |
CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include -I/opt/homebrew/opt/libomp/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/libomp/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Submodule recursive | |
run: | | |
git submodule update --init --recursive | |
git status | |
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. | |
- uses: lukka/get-cmake@latest | |
# Restore both vcpkg and its artifacts from the GitHub cache service. | |
- name: Restore vcpkg and its artifacts. | |
uses: actions/cache@v3 | |
with: | |
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. | |
# The second path is the location of vcpkg (it contains the vcpkg executable and data files). | |
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ | |
${{ env.VCPKG_ROOT }} | |
!${{ env.VCPKG_ROOT }}/buildtrees | |
!${{ env.VCPKG_ROOT }}/packages | |
!${{ env.VCPKG_ROOT }}/downloads | |
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. | |
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. | |
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). | |
key: | | |
${{ hashFiles( 'external/LibAPR/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate | |
- name: Check file paths | |
run: | | |
cd ${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/ | |
ls | |
- name: Show content of workspace after cache has been restored | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.9' | |
- name: Install cibuildwheel | |
run: | | |
python3 -m pip install cibuildwheel | |
- name: Install OpenMP dependencies with brew for OSX | |
if: contains(matrix.os,'macos') | |
run: | | |
brew install llvm | |
brew install libomp | |
brew install c-blosc | |
brew install hdf5 | |
brew reinstall libtiff | |
- name: Run cibuildwheel | |
run: | | |
git status | |
python3 -m cibuildwheel --output-dir ${{matrix.builddir}} | |
- name: Upload wheels as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-wheels | |
path: ${{matrix.builddir}}/ | |
retention-days: 30 | |
windows-tests: | |
name: ${{ matrix.os }} py${{ matrix.python-version }} tests | |
runs-on: ${{ matrix.os }} | |
needs: build-wheels | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest ] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download wheels from artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-wheels | |
path: wheelhouse | |
- name: Set version string | |
shell: bash | |
run: echo "py_version_str=cp$(echo ${{ matrix.python-version }} | tr -d -c 0-9)" >> $GITHUB_ENV | |
- name: Install package from wheel | |
shell: bash | |
run: | | |
ls -R wheelhouse | |
python -m pip install --upgrade pip | |
pip install wheelhouse/pyapr-*${{ env.py_version_str }}*.whl | |
- name: Run tests | |
run: | | |
pip install pytest pytest-qt | |
pytest -vv | |
deploy: | |
runs-on: ubuntu-latest | |
needs: windows-tests | |
name: publish to pypi | |
# only run on push of (version) tag | |
if: contains(github.ref, 'tags') | |
steps: | |
- name: Download wheels from artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: wheelhouse | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U twine | |
- name: Publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
twine upload wheelhouse/*wheels/*.whl |