Files
Karl Seguin 7c6497fb00 add make fmt
Switch to make fmt for formatting. The issue with zig fmt --check ./ is that it
ends up checking zig-pkg. Really need to give an explicit list, which is were
the make target comes in (also updated the github action so use that same target
to keep everything consistent)
2026-11-14 08:27:25 +08:00

193 lines
5.4 KiB
YAML

name: zig-test
env:
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 }}
LIGHTPANDA_DISABLE_TELEMETRY: true
on:
push:
branches: [main]
paths:
- ".github/**"
- "src/**"
- "build.zig"
- "build.zig.zon"
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:
- ".github/**"
- "src/**"
- "build.zig"
- "build.zig.zon"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
jobs:
zig-fmt:
name: zig fmt
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
# Zig version used from the `minimum_zig_version` field in build.zig.zon
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
- name: Run zig fmt
id: fmt
run: make fmt
zig-test-debug:
name: zig test using v8 in debug mode
needs: zig-fmt
runs-on: ubuntu-latest
timeout-minutes: 25
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
fetch-depth: 0
- uses: ./.github/actions/install
with:
debug: true
- name: zig build test
run: zig build -Dprebuilt_v8_path=v8/libc_v8_debug.a -Dtsan=true test
zig-test-release:
name: zig test
needs: zig-fmt
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
fetch-depth: 0
- uses: ./.github/actions/install
- name: zig build test
run: METRICS=true zig build -Dprebuilt_v8_path=v8/libc_v8.a test > bench.json
- name: write commit
run: |
echo "${{github.sha}}" > commit.txt
- name: upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bench-results
path: |
bench.json
commit.txt
retention-days: 10
chrome-test:
name: html tests in chrome
needs: zig-fmt
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
repository: 'lightpanda-io/demo'
path: demo
- uses: ./.github/actions/install
# Always the current stable release, not the runner image's copy, so
# a new Chrome stable release that changes a result fails here.
- name: install chrome stable
run: |
curl -sSfL -o /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y --allow-downgrades /tmp/chrome.deb
google-chrome-stable --version
# Compiles first, so the wait covers the build.
- name: start test server
run: |
zig build -Dprebuilt_v8_path=v8/libc_v8.a test-server > test-server.log 2>&1 &
timeout 600 bash -c 'until curl -sf -o /dev/null http://127.0.0.1:9582/reset; do sleep 1; done'
- run: npm install
working-directory: demo
# run.js launches Chrome itself, with the same pinned environment
# (locale, timezone, no field trials, no audio device) as locally.
- name: run html tests
working-directory: demo
run: BROWSER_REPO=${{ github.workspace }} node browser-tests/run.js
- name: test server log
if: failure()
run: cat test-server.log
bench-fmt:
name: perf-fmt
needs: zig-test-release
# The perf-fmt image is private to the organisation, so pulling it
# with GITHUB_TOKEN needs packages read on this job.
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name != 'pull_request'
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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: bench-results
- name: format and send json result
run: /perf-fmt bench-browser ${{ github.sha }} bench.json