Skip to content

Commit

Permalink
Build ppx for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
DZakh committed Jul 31, 2023
1 parent 4ad3959 commit d7810c4
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
46 changes: 46 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@master
with:
name: ppx_build_linux
path: 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,12 @@ jobs:
cache: "pnpm"
- run: pnpm install

- name: Download ppx linux artifacts
uses: actions/download-artifact@master
with:
name: ppx_build_linux
path: binaries/linux

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

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

benchmark:
name: Benchmark
needs: [ppx_build_linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -61,6 +101,12 @@ jobs:
cache: "pnpm"
- run: pnpm install

- name: Download ppx linux artifacts
uses: actions/download-artifact@master
with:
name: ppx_build_linux
path: binaries/linux

- 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

0 comments on commit d7810c4

Please sign in to comment.