-
Notifications
You must be signed in to change notification settings - Fork 9
163 lines (147 loc) · 5.11 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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