chore: fix ci #233
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: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v2 | |
- name: Setup Deno | |
uses: denoland/setup-deno@main | |
with: | |
deno-version: 'v1.x' | |
- name: Check Formatting | |
run: deno fmt --check | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Deno | |
uses: denoland/setup-deno@main | |
with: | |
deno-version: 'v1.x' | |
- name: Setup Depot Tools (Unix) | |
if: runner.os != 'Windows' | |
run: | | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
echo "PATH=$(pwd)/depot_tools:$PATH" >> $GITHUB_ENV | |
- name: Setup Depot Tools (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
curl -o depot_tools.zip https://storage.googleapis.com/chrome-infra/depot_tools.zip | |
mkdir depot_tools | |
cd depot_tools | |
7z x ../depot_tools.zip | |
cd .. | |
echo "PATH=$(pwd)/depot_tools;$PATH" >> $GITHUB_ENV | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install xorg-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libgl1-mesa-glx libglx-dev | |
- name: Download Skia Binaries | |
env: | |
SKIA_FROM_SOURCE: 0 | |
run: deno task build-skia | |
- name: Setup Build Directory | |
run: mkdir ./native/build | |
- name: Build Native Library (Unix) | |
if: runner.os != 'Windows' | |
run: deno task build | |
- name: Build Native Library (macOS x86_64) | |
if: runner.os == 'macOS' | |
env: | |
TARGET_ARCH: x86_64 | |
run: | | |
deno task build-skia | |
cp ./native/build/libnative_canvas{,_aarch64}.dylib | |
deno task build-macos-x86_64 | |
cp ./native/build/libnative_canvas{,_x86_64}.dylib | |
cp ./native/build/libnative_canvas{_aarch64,}.dylib | |
- name: Build Native Library (Windows) | |
if: runner.os == 'Windows' | |
run: deno task build-win | |
- name: Strip Native Library (Linux) | |
if: runner.os == 'Linux' | |
run: strip ./native/build/libnative_canvas.so | |
- name: Setup ICU Data | |
if: runner.os == 'Windows' | |
run: cp ./skia/out/Release/icudtl.dat ./native/build/Release/icudtl.dat | |
- name: Run Tests | |
env: | |
DENO_SKIA_LOCAL: 1 | |
run: deno run -A --unstable test/test.ts | |
- name: Rename x86_64 binary (macOS) | |
if: runner.os == 'macOS' | |
run: cp ./native/build/libnative_canvas{_x86_64,}.dylib | |
- name: Release | |
uses: softprops/action-gh-release@master | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "release draft" | |
draft: true | |
files: | | |
skia/out/Release/icudtl.dat | |
native/build/libnative_canvas.so | |
native/build/libnative_canvas.dylib | |
native/build/libnative_canvas_aarch64.dylib | |
native/build/Release/native_canvas.dll |