Skip to content

Add CI tests

Add CI tests #5

Workflow file for this run

name: benchmark
env:
ARCH: x86_64-linux
on:
push:
branches:
- main
paths:
- "src/**/*.zig"
- "src/*.zig"
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]
branches:
- main
# paths:
# - "src/**/*.zig"
# - "src/*.zig"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
benchmark:
name: benchmark
# Don't run the CI with draft PR.
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: ghcr.io/browsercore/zig-v8:0.11.0
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_CI_PAT }}
submodules: true
- name: install v8
run: |
mkdir -p vendor/v8/${{env.ARCH}}/debug
ln -s /usr/local/lib/libc_v8.a vendor/v8/${{env.ARCH}}/debug/libc_v8.a
mkdir -p vendor/v8/${{env.ARCH}}/release
ln -s /usr/local/lib/libc_v8.a vendor/v8/${{env.ARCH}}/release/libc_v8.a
- run: zig build -Doptimize=ReleaseSafe -Dengine=v8
- name: run benchmark
run: |
./zig-out/bin/jsruntime-bench > benchmark.txt
cat benchmark.txt
- name: write commit
run: |
echo "${{github.sha}}" > commit.txt
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: |
benchmark.txt
commit.txt
# configure the retention policy: 10 days on PR and 150 on main.
retention-days: ${{ github.event == "pull_request" && 10 || 150 }}

Check failure on line 78 in .github/workflows/benchmark.yml

View workflow run for this annotation

GitHub Actions / benchmark

Invalid workflow file

The workflow is not valid. .github/workflows/benchmark.yml (Line: 78, Col: 27): Unexpected symbol: '"pull_request"'. Located at position 17 within expression: github.event == "pull_request" && 10 || 150