diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 0000000..7b2da10 --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,61 @@ +name: "V8 install" +description: "Install deps for the project" + +inputs: + zig: + description: 'Zig version to install' + required: false + default: '0.12.1' + arch: + description: 'CPU arch used to select the v8 lib' + required: false + default: 'x86_64' + os: + description: 'OS used to select the v8 lib' + required: false + default: 'linux' + zig-v8: + description: 'zig v8 version to install' + required: false + default: 'v0.1.5' + v8: + description: 'v8 version to install' + required: false + default: '11.1.134' + cache-dir: + description: 'cache dir to use' + required: false + default: '~/.cache' + +runs: + using: "composite" + + steps: + - uses: mlugg/setup-zig@v1 + with: + version: ${{ inputs.zig }} + + - name: Cache v8 + id: cache-v8 + uses: actions/cache@v3 + env: + cache-name: cache-v8 + with: + path: ${{ inputs.cache-dir }}/v8 + key: libc_v8_${{ inputs.v8 }}_${{ inputs.os }}_${{ inputs.arch }}.a + + - if: ${{ steps.cache-v8.outputs.cache-hit != 'true' }} + shell: bash + run: | + mkdir -p ${{ inputs.cache-dir }}/v8 + + wget -O ${{ inputs.cache-dir }}/v8/libc_v8.a https://github.com/lightpanda-io/zig-v8-fork/releases/download/${{ inputs.zig-v8 }}/libc_v8_${{ inputs.v8 }}_${{ inputs.os }}_${{ inputs.arch }}.a + + - name: install v8 + shell: bash + run: | + mkdir -p vendor/v8/${{inputs.arch}}-${{inputs.os}}/debug + ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a vendor/v8/${{inputs.arch}}-${{inputs.os}}/debug/libc_v8.a + + mkdir -p vendor/v8/${{inputs.arch}}-${{inputs.os}}/release + ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a vendor/v8/${{inputs.arch}}-${{inputs.os}}/release/libc_v8.a diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d717403..e30b525 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,7 +1,6 @@ name: benchmark 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 }} @@ -35,35 +34,18 @@ 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/lightpanda-io/zig-v8:0.12.1 - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - # docker blocks io_uring syscalls by default now. - # see https://github.com/tigerbeetle/tigerbeetle/pull/1995 - # see https://github.com/moby/moby/pull/46762 - options: "--security-opt seccomp=unconfined" + # Don't run the CI with draft PR. + if: github.event.pull_request.draft == false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 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 + - uses: ./.github/actions/install - run: zig build -Doptimize=ReleaseSafe -Dengine=v8 - name: run benchmark diff --git a/.github/workflows/zig-fmt.yml b/.github/workflows/zig-fmt.yml index c6cc183..f0a61ae 100644 --- a/.github/workflows/zig-fmt.yml +++ b/.github/workflows/zig-fmt.yml @@ -1,5 +1,8 @@ name: zig-fmt +env: + ZIG_VERSION: 0.12.1 + on: pull_request: @@ -27,16 +30,13 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest - container: - image: ghcr.io/lightpanda-io/zig:0.12.1 - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - outputs: - zig_fmt_errs: ${{ steps.fmt.outputs.zig_fmt_errs }} steps: - - uses: actions/checkout@v3 + - uses: mlugg/setup-zig@v1 + with: + version: ${{ env.ZIG_VERSION }} + + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index 3f69863..f27d9d0 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -1,8 +1,5 @@ name: zig-test -env: - ARCH: x86_64-linux - on: push: branches: @@ -39,26 +36,14 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest - container: - image: ghcr.io/lightpanda-io/zig-v8:0.12.1 - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 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 + - uses: ./.github/actions/install - name: zig build debug run: zig build -Dengine=v8 @@ -70,26 +55,14 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest - container: - image: ghcr.io/lightpanda-io/zig-v8:0.12.1 - 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 + - uses: ./.github/actions/install - name: zig build release run: zig build -Doptimize=ReleaseSafe -Dengine=v8 @@ -101,31 +74,14 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest - container: - image: ghcr.io/lightpanda-io/zig-v8:0.12.1 - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # docker blocks io_uring syscalls by default now. - # see https://github.com/tigerbeetle/tigerbeetle/pull/1995 - # see https://github.com/moby/moby/pull/46762 - options: "--security-opt seccomp=unconfined" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 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 + - uses: ./.github/actions/install - name: zig build test run: zig build test -Dengine=v8