Skip to content

Introduce val for building operations #419

Introduce val for building operations

Introduce val for building operations #419

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ppx-build-linux:
name: ppx-build-linux
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/rescript-schema-ppx/src
strategy:
matrix:
ocaml-compiler:
- 4.12.1
container:
image: ocaml/opam:alpine-3.16-ocaml-4.12
options: --user root
steps:
- uses: actions/checkout@v3
- name: Opam init
run: opam init -a --disable-sandboxing --compiler=${{ matrix.ocaml-compiler }}
- name: Install deps
run: opam install . --deps-only --with-test
- name: Build
run: opam exec -- dune build --profile static
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ppx-build-linux
path: packages/rescript-schema-ppx/src/_build/default/bin/bin.exe
if-no-files-found: error
ppx-build-macos:
name: ppx-build-macos
runs-on: macOS-latest
defaults:
run:
working-directory: packages/rescript-schema-ppx/src
strategy:
matrix:
ocaml-compiler:
- 4.12.1
steps:
- uses: actions/checkout@v3
- name: Use OCaml ${{ matrix.ocaml-compiler}}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Install deps
run: opam install . --deps-only --with-test
- name: Build
run: opam exec -- dune build
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: ppx-build-macos
path: packages/rescript-schema-ppx/src/_build/default/bin/bin.exe
if-no-files-found: error
ppx-build-windows:
name: ppx-build-windows
runs-on: windows-latest
defaults:
run:
working-directory: packages/rescript-schema-ppx/src
strategy:
matrix:
ocaml-compiler:
- 4.12.1
steps:
- uses: actions/checkout@v3
- name: Use OCaml ${{ matrix.ocaml-compiler}}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Install deps
run: opam install . --deps-only --with-test
- name: Build
run: opam exec -- dune build
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: ppx-build-windows
path: packages/rescript-schema-ppx/src/_build/default/bin/bin.exe
if-no-files-found: error
test:
name: Test
needs: [ppx-build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18.12
cache: "pnpm"
- run: pnpm install
- name: Download ppx linux artifacts
uses: actions/download-artifact@v3
with:
name: ppx-build-linux
path: binaries/linux
- name: Move ppx artifacts
run: |
mv binaries/linux/bin.exe packages/rescript-schema-ppx/ppx-linux.exe
- name: Install ppx
run: pnpm ppx:install
- run: pnpm exec rescript build
working-directory: packages/tests
- run: pnpm lint:stdlib
- run: pnpm coverage
- uses: codecov/codecov-action@v3
with:
files: coverage/lcov.info
pack-rescript-schema:
name: Pack rescript-schema
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm res:build
working-directory: packages/prepack
- run: pnpm lint:stdlib
working-directory: packages/prepack
- run: pnpm prepack
- name: "Upload artifact: rescript-schema npm package"
uses: actions/upload-artifact@v3
with:
name: rescript-schema
path: packages/artifacts
pack-rescript-schema-ppx:
name: Pack rescript-schema-ppx
needs: [ppx-build-linux, ppx-build-macos, ppx-build-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- name: Download ppx linux artifacts
uses: actions/download-artifact@v3
with:
name: ppx-build-linux
path: binaries/linux
- name: Download macOS artifacts
uses: actions/download-artifact@master
with:
name: ppx-build-macos
path: binaries/macos
- name: Download windows artifacts
uses: actions/download-artifact@master
with:
name: ppx-build-windows
path: binaries/windows
- name: Move ppx artifacts
run: |
mv binaries/linux/bin.exe packages/rescript-schema-ppx/ppx-linux.exe
mv binaries/macos/bin.exe packages/rescript-schema-ppx/ppx-osx.exe
mv binaries/windows/bin.exe packages/rescript-schema-ppx/ppx-windows.exe
- name: npm pack (rescript-schema-ppx)
run: npm pack
working-directory: packages/rescript-schema-ppx
- name: "Upload artifact: rescript-schema-ppx npm package"
uses: actions/upload-artifact@v3
with:
name: rescript-schema-ppx
path: packages/rescript-schema-ppx/rescript-schema-ppx-6.4.0.tgz
benchmark:
name: Benchmark
needs: [ppx-build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- name: Download ppx linux artifacts
uses: actions/download-artifact@v3
with:
name: ppx-build-linux
path: binaries/linux
- name: Move ppx artifacts
run: |
mv binaries/linux/bin.exe packages/rescript-schema-ppx/ppx-linux.exe
- name: Install ppx
run: pnpm ppx:install
- run: pnpm res:build
working-directory: packages/prepack
- name: Run benchmark
run: pnpm benchmark | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "benchmarkjs"
output-file-path: output.txt
external-data-json-path: ./cache/benchmark-data.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: "150%"
comment-always: true
comment-on-alert: true