mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
220 lines
6.7 KiB
YAML
220 lines
6.7 KiB
YAML
name: zig-test
|
|
|
|
env:
|
|
ARCH: x86_64-linux
|
|
AWS_ACCESS_KEY_ID: ${{ vars.LPD_PERF_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.LPD_PERF_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_BUCKET: ${{ vars.LPD_PERF_AWS_BUCKET }}
|
|
AWS_REGION: ${{ vars.LPD_PERF_AWS_REGION }}
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "build.zig"
|
|
- "src/**/*.zig"
|
|
- "src/*.zig"
|
|
- "vendor/jsruntime-lib"
|
|
pull_request:
|
|
|
|
# By default GH trigger on types opened, synchronize and reopened.
|
|
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
|
|
# Since we skip the job when the PR is in draft state, we want to force CI
|
|
# running when the PR is marked ready_for_review w/o other change.
|
|
# see https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
paths:
|
|
- "build.zig"
|
|
- "src/**/*.zig"
|
|
- "src/*.zig"
|
|
- "vendor/**"
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
pull-requests: read # required for dorny/paths-filter
|
|
contents: read
|
|
packages: read
|
|
|
|
jobs:
|
|
zig-build-dev:
|
|
name: zig build dev
|
|
|
|
# Don't run the CI with draft PR.
|
|
if: github.event.pull_request.draft == false
|
|
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/lightpanda-io/zig-browsercore:0.12.0-dev.1773-8a8fd47d2
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_CI_PAT }}
|
|
# fetch submodules recusively, to get jsruntime-lib submodules also.
|
|
submodules: recursive
|
|
|
|
- name: install v8
|
|
run: |
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
|
|
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
|
|
|
|
- name: install deps
|
|
run: |
|
|
ln -s /usr/local/lib/libiconv vendor/libiconv
|
|
|
|
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
|
|
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
|
|
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
|
|
|
|
- name: zig build debug
|
|
run: zig build -Dengine=v8
|
|
|
|
zig-build-release:
|
|
name: zig build release
|
|
|
|
# Don't run the CI with draft PR.
|
|
if: github.event.pull_request.draft == false
|
|
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/lightpanda-io/zig-browsercore:0.12.0-dev.1773-8a8fd47d2
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_CI_PAT }}
|
|
# fetch submodules recusively, to get jsruntime-lib submodules also.
|
|
submodules: recursive
|
|
|
|
- name: install v8
|
|
run: |
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
|
|
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
|
|
|
|
- name: install deps
|
|
run: |
|
|
ln -s /usr/local/lib/libiconv vendor/libiconv
|
|
|
|
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
|
|
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
|
|
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
|
|
|
|
- name: zig build release
|
|
run: zig build -Doptimize=ReleaseSafe -Dengine=v8
|
|
|
|
zig-test:
|
|
name: zig test
|
|
|
|
# Don't run the CI with draft PR.
|
|
if: github.event.pull_request.draft == false
|
|
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/lightpanda-io/zig-browsercore:0.12.0-dev.1773-8a8fd47d2
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_CI_PAT }}
|
|
# fetch submodules recusively, to get jsruntime-lib submodules also.
|
|
submodules: recursive
|
|
|
|
- name: install v8
|
|
run: |
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
|
|
|
|
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
|
|
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
|
|
|
|
- name: install deps
|
|
run: |
|
|
ln -s /usr/local/lib/libiconv vendor/libiconv
|
|
|
|
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
|
|
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
|
|
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
|
|
|
|
# detect file change
|
|
- uses: dorny/paths-filter@v3.0.2
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
netsurf:
|
|
- 'vendor/netsurf/**'
|
|
|
|
# if a vendor has changed, install build dependencies.
|
|
- name: install build dependencies
|
|
if: steps.changes.outputs.netsurf == 'true'
|
|
run: |
|
|
apt update && \
|
|
apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \
|
|
libglib2.0-dev gperf libexpat1-dev cmake build-essential
|
|
|
|
# if netsurf has changed, force a rebuild.
|
|
- name: build netsurf
|
|
if: steps.changes.outputs.netsurf == 'true'
|
|
run: |
|
|
make clean-netsurf
|
|
make install-netsurf
|
|
|
|
- name: zig build test
|
|
run: zig build test -Dengine=v8 -- --json > bench.json
|
|
|
|
- name: write commit
|
|
run: |
|
|
echo "${{github.sha}}" > commit.txt
|
|
|
|
- name: upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: bench-results
|
|
path: |
|
|
bench.json
|
|
commit.txt
|
|
retention-days: 10
|
|
|
|
bench-fmt:
|
|
name: perf-fmt
|
|
needs: zig-test
|
|
|
|
# Don't execute on PR
|
|
if: github.event_name != 'pull_request'
|
|
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/lightpanda-io/perf-fmt:latest
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- name: download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: bench-results
|
|
|
|
- name: format and send json result
|
|
run: /perf-fmt bench-browser ${{ github.sha }} bench.json
|