feature(test): setup running tests with cmake and IDE #17
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- 0.3.x | |
pull_request: | |
branches: | |
- 0.3.x | |
jobs: | |
# Adapted from https://github.com/beberlei/hdrhistogram-php | |
tests: | |
name: Tests (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
libuv: ["1.48.0"] | |
php: | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
- "8.4" | |
phpts: | |
- "ts" | |
- "nts" | |
steps: | |
- run: | | |
sudo apt-get remove --purge --autoremove 'php*' | |
sudo apt update && sudo apt-get install -y pkg-config clang build-essential | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-file: development | |
coverage: none | |
tools: none | |
env: | |
phpts: ${{ matrix.phpts }} | |
debug: true | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: "3.24" | |
- uses: seanmiddleditch/gha-setup-ninja@v5 | |
- name: Cache Libuv | |
id: cache-libuv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/libuv | |
key: libuv-${{ matrix.libuv }}-${{ runner.arch }}-${{ runner.os }} | |
- name: "Install Libuv" | |
if: steps.cache-libuv.outputs.cache-hit != 'true' | |
working-directory: /opt | |
run: | | |
curl -L "https://github.com/libuv/libuv/archive/v${{ matrix.libuv }}.tar.gz" | tar xzf - | |
mv "libuv-${{ matrix.libuv }}" libuv-src && cd libuv-src | |
mkdir build && cd build | |
cmake -G Ninja \ | |
-DBUILD_TESTING=OFF \ | |
-DLIBUV_BUILD_SHARED=ON \ | |
-DCMAKE_INSTALL_PREFIX="/opt/libuv" \ | |
-DCMAKE_BUILD_TYPE="RelWithInfo" .. | |
sudo ninja install | |
- name: Compile uv extension | |
run: | | |
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/libuv/lib/pkgconfig" | |
phpize | |
./configure --enable-ext-testing --enable-uv-debug | |
make -j$(getconf _NPROCESSORS_ONLN) | |
sudo make install | |
echo "extension = uv" >> $(php -r 'echo php_ini_loaded_file();') | |
- name: Run the tests | |
run: php run-tests.php -q -j$(getconf _NPROCESSORS_ONLN) -p $(which php) --show-diff --set-timeout 120 |