Skip to content

Commit

Permalink
Build ppx for linux (#62)
Browse files Browse the repository at this point in the history
* Build ppx for linux

* Fix path to artifacts

* Move ppx artifacts

* Install ppx in ci

* Fix Move ppx artifacts
  • Loading branch information
DZakh authored Jul 31, 2023
1 parent 4ad3959 commit a016b31
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 13 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,41 @@ on:
- main

jobs:
ppx_build_linux:
name: ppx_build_linux
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/ppx/src
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=4.12.1

- name: Install deps
run: opam install . --deps-only --with-test

- name: Build
run: opam exec -- dune build --profile static

- name: Copy built PPX file
run: |
mv ./_build/default/bin/bin.exe ppx.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ppx_build_linux
path: packages/ppx/src/ppx.exe
if-no-files-found: error

test:
name: Test
needs: [ppx_build_linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -21,6 +54,19 @@ jobs:
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/ppx.exe packages/ppx/ppx-linux.exe
- name: Install ppx
run: npm run ppx:install

- run: npm run res:build
working-directory: packages/tests

Expand Down Expand Up @@ -51,6 +97,7 @@ jobs:

benchmark:
name: Benchmark
needs: [ppx_build_linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -61,6 +108,19 @@ jobs:
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/ppx.exe packages/ppx/ppx-linux.exe
- name: Install ppx
run: npm run ppx:install

- run: npm run res:build
working-directory: packages/prepack

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"res": "rescript build -with-deps -w",
"test:res": "pnpm --filter=tests res",
"test": "ava",
"prepack": "node ./packages/prepack/src/Prepack.bs.mjs"
"prepack": "node ./packages/prepack/src/Prepack.bs.mjs",
"ppx:install": "node ./packages/ppx/install.cjs"
},
"ava": {
"extensions": {
Expand Down
11 changes: 0 additions & 11 deletions packages/ppx/.npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ppx/install.js → packages/ppx/install.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const installMacLinuxBinary = (binary) => {
fs.renameSync(source, target);

// The ppx should be executable in the bundle, but just in case
fs.chmodSync(target, 0777);
fs.chmodSync(target, 0o777);
} else {
// assume we're in dev mode - nothing will break if the script
// isn't overwritten, it will just be slower
Expand Down

1 comment on commit a016b31

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a016b31 Previous: 06917fe Ratio
Parse string 703059963 ops/sec (±0.39%) 768626561 ops/sec (±1.37%) 1.09
Serialize string 706597260 ops/sec (±0.42%) 762449917 ops/sec (±0.91%) 1.08
Advanced object struct factory 295710 ops/sec (±0.47%) 175313 ops/sec (±1.22%) 0.59
Parse advanced object 24290247 ops/sec (±0.19%) 19649867 ops/sec (±1.35%) 0.81
Create and parse advanced object 71658 ops/sec (±0.75%) 44890 ops/sec (±1.18%) 0.63
Parse advanced strict object 13448376 ops/sec (±0.16%) 11823782 ops/sec (±2.57%) 0.88
Serialize advanced object 36469731 ops/sec (±0.46%) 9024665 ops/sec (±1.18%) 0.25

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.