diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c11c3936..c411fde9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -51,6 +90,7 @@ jobs: benchmark: name: Benchmark + needs: [ppx_build_linux] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -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 diff --git a/package.json b/package.json index eb1d2818..931b0158 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/packages/ppx/.npmignore b/packages/ppx/.npmignore deleted file mode 100644 index ffdd3817..00000000 --- a/packages/ppx/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -.github -.vscode -examples -test -src/bin -src/ppx -src/.ocamlformat -src/dune -src/dune-project -src/dune-workspace -src/ppx_struct.opam diff --git a/packages/ppx/install.js b/packages/ppx/install.cjs similarity index 97% rename from packages/ppx/install.js rename to packages/ppx/install.cjs index fe2edbdc..459bbf59 100644 --- a/packages/ppx/install.js +++ b/packages/ppx/install.cjs @@ -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