Skip to content

Add CMake build and GitHub Actions CI for cross-platform validate-dnr… #1

Add CMake build and GitHub Actions CI for cross-platform validate-dnr…

Add CMake build and GitHub Actions CI for cross-platform validate-dnr… #1

name: Build validate-dnr-rules
on:
push:
branches: [ghostery/*]
paths:
- 'ghostery/validate-dnr-rules/**'
- 'Source/WebCore/contentextensions/**'
- '.github/workflows/validate-dnr-rules.yml'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
name: macos-arm64
- os: ubuntu-latest
name: linux-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libicu-dev pkg-config \
ruby ruby-dev libglib2.0-dev unifdef
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cmake ninja icu4c pkg-config
- name: Configure
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPORT=GTK \
-DENABLE_WEBCORE=OFF \
-DENABLE_WEBKIT=OFF \
-DENABLE_TOOLS=OFF \
ghostery/validate-dnr-rules
env:
CMAKE_PREFIX_PATH: ${{ runner.os == 'macOS' && '/opt/homebrew/opt/icu4c' || '' }}
- name: Build
run: cmake --build build --target validate-dnr-rules
- name: Test
run: |
echo '[{"id":1,"priority":1,"action":{"type":"block"},"condition":{"regexFilter":"ad[0-9]{2}\\.js"}}]' > /tmp/test-rules.json
./build/validate-dnr-rules /tmp/test-rules.json
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: validate-dnr-rules-${{ matrix.name }}
path: build/validate-dnr-rules