Use correct path for wheels for upload to PyPI #170
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
name: Run tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
env: | |
BUILD_TEMP_DIR: "build" | |
LIBGL_ALWAYS_SOFTWARE: 1 | |
jobs: | |
test: | |
name: Test on ${{ matrix.os }} ${{ matrix.platform }} (Python ${{ matrix.python-version }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "ubuntu-24.04" | |
- "ubuntu-22.04" | |
- "ubuntu-20.04" | |
- "macos-14" | |
include: | |
- os: "ubuntu-24.04" | |
platform: "x86_64" | |
- os: "ubuntu-22.04" | |
platform: "x86_64" | |
- os: "ubuntu-20.04" | |
platform: "x86_64" | |
- os: "macos-14" | |
platform: "arm64" | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Checkout submodules | |
run: | | |
git submodule update --init | |
cd vendor/nanobind && \ | |
git submodule update --init --recursive | |
cd ../maplibre-native && \ | |
git submodule update --init --recursive \ | |
vendor/boost \ | |
vendor/cpp-httplib \ | |
vendor/earcut.hpp \ | |
vendor/eternal \ | |
vendor/googletest \ | |
vendor/polylabel \ | |
vendor/protozero \ | |
vendor/mapbox-base \ | |
vendor/unique_resource \ | |
vendor/unordered_dense \ | |
vendor/vector-tile \ | |
vendor/wagyu \ | |
vendor/zip-archive | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install \ | |
curl \ | |
build-essential \ | |
cmake \ | |
ninja-build \ | |
ccache \ | |
pkg-config \ | |
libcurl4-openssl-dev \ | |
libicu-dev \ | |
libjpeg-turbo8-dev \ | |
libpng-dev \ | |
libwebp-dev \ | |
libprotobuf-dev \ | |
libuv1-dev \ | |
libx11-dev \ | |
libegl-dev \ | |
libopengl-dev \ | |
libgles2-mesa-dev \ | |
xvfb | |
/usr/sbin/update-ccache-symlinks | |
- name: fix Ubuntu 24.04 dependencies | |
if: ${{ matrix.os == 'ubuntu-24.04' }} | |
run: | | |
sudo apt-get install -y software-properties-common && \ | |
sudo add-apt-repository -y ppa:kisak/kisak-mesa && \ | |
sudo apt-get update && \ | |
sudo apt-get install -y libglx-mesa0 | |
- name: Upgrade Ubuntu 20.04 GCC | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: | | |
sudo apt-get install -y software-properties-common && \ | |
sudo add-apt-repository --update -y ppa:ubuntu-toolchain-r/test && \ | |
sudo apt-get update && \ | |
sudo apt-get -y --fix-broken install gcc-13 g++-13 && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 131 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 && \ | |
gcc -v | |
- name: Install MacOS dependencies | |
if: runner.os == 'macOS' | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
run: | | |
brew install ccache ninja | |
- name: Install python | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh && \ | |
. $HOME/.cargo/env && \ | |
uv python install ${{ matrix.python-version }} && \ | |
uv venv .venv | |
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV | |
echo "$PWD/.venv/bin" >> $GITHUB_PATH | |
- name: Prepare ccache | |
run: ccache --clear --set-config cache_dir=~/.ccache | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
env: | |
cache-name: ccache-v1 | |
with: | |
path: ~/.ccache | |
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} | |
restore-keys: | | |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }} | |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }} | |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }} | |
- name: Clear ccache statistics | |
run: | | |
ccache --zero-stats --set-config cache_dir=~/.ccache | |
ccache --max-size=2G --set-config cache_dir=~/.ccache | |
ccache --show-stats --set-config cache_dir=~/.ccache | |
- name: Build package | |
env: | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
run: | | |
sudo mkdir -p $BUILD_TEMP_DIR | |
sudo chown -R $(id -u):$(id -g) $BUILD_TEMP_DIR | |
uv pip install -e .[dev,test] | |
- name: Run Linux tests | |
if: runner.os == 'Linux' | |
run: | | |
xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +render -noreset" \ | |
build/tests/pymgl_test | |
xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +render -noreset" \ | |
python -m pytest pymgl/tests | |
- name: Run MacOS tests | |
if: runner.os == 'macOS' | |
run: | | |
build/tests/pymgl_test | |
python -m pytest pymgl/tests |