diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..adacf9ebe1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,80 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/setup-node@v1.4.2 + with: + node-version: 12 + - uses: actions/checkout@v2.2.0 + - name: Install esy + run: npm install -g esy + + - name: Try to restore install cache + uses: actions/cache@v2 + with: + path: ~/.esy/source + key: source-${{ hashFiles('**/index.json') }} + + - name: Clone submodules + run: git submodule update --init + + - name: Install + run: esy install + + - name: Print esy cache + uses: actions/github-script@v2 + id: print_esy_cache + with: + script: | + const path = require('path') + const scriptPath = path.resolve('.github/workflows/print_esy_cache.js') + require(scriptPath)(core) + + - name: Try to restore build cache + id: deps-cache + uses: actions/cache@v2 + with: + path: ${{ steps.print_esy_cache.outputs.esy_cache }} + key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }} + restore-keys: build-${{ matrix.os }}- + + # Here we use a low-level. In real situation you don't have to + # but it is useful in CI as it split the log in GitHub UI. + # You can see at a glance if it is your projet or your deps that break. + # + # We also use --release flag to build less. + # This allow us to spo syntax/type error more quickly. + - name: Build release dependencies + if: steps.deps-cache.outputs.cache-hit != 'true' + run: esy build-dependencies --release + + - name: Build project in release + run: esy build --release + + # Now that our core project build let builds others deps + - name: Build dependencies + if: steps.deps-cache.outputs.cache-hit != 'true' + run: esy build-dependencies + + - name: Build project + run: esy build + + # Here we cleanup if we have a cache fail because we use restore-keys. + # restore-keys take the old store even on cache fail. + # So, we have deps we don't care anymore. We prune them. + - name: Clean global store + if: steps.deps-cache.outputs.cache-hit != 'true' + run: esy cleanup . + + - name: Test + run: esy test + + - name: Build docs + run: esy doc diff --git a/.github/workflows/print_esy_cache.js b/.github/workflows/print_esy_cache.js new file mode 100644 index 0000000000..a1498fe5db --- /dev/null +++ b/.github/workflows/print_esy_cache.js @@ -0,0 +1,14 @@ +const fs = require("fs"); +const os = require("os"); +const path = require("path"); + +const ESY_FOLDER = process.env.ESY__PREFIX + ? process.env.ESY__PREFIX + : path.join(os.homedir(), ".esy"); +const esy3 = fs + .readdirSync(ESY_FOLDER) + .filter(name => name.length > 0 && name[0] === "3") + .sort() + .pop(); +module.exports = exports = core => + core.setOutput('esy_cache', path.join(ESY_FOLDER, esy3, "i")); diff --git a/4061.json b/4061.json deleted file mode 100644 index b5dfd6c8f5..0000000000 --- a/4061.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "source": "./esy.json", - "override": { - "resolutions": { - "ocaml": "ulrikstrid/ocaml:package.json#68e181a3a44f0b6be1b1ab1e585d2c9f2718c37b" - } - } -} diff --git a/esy.json b/esy.json index 42db6276a1..a1fff09e6d 100644 --- a/esy.json +++ b/esy.json @@ -1,6 +1,6 @@ { "name": "bs-platform", - "version": "7.2.0", + "version": "8.3.0-dev.2", "dependencies": { "ocaml": "4.6.1000+BS" }, @@ -8,13 +8,14 @@ "ocaml": "4.6.1000+BS" }, "resolutions": { - "ocaml": "bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400" + "ocaml": "Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57" }, "scripts": { + "doc": "echo here we can generate doc for rescript-lang and push", + "test": "echo here we can actually test the binary work maybe with bsc -e 'code'", "clean": "node ./scripts/ninja.js clean" }, "esy": { - "buildsInSource": true, "build": [ ["node", "./scripts/install.js"], ["cp", "-r", "-f", "#{self.root / 'bsconfig.json'}", "#{self.install}"], diff --git a/esy.lock/index.json b/esy.lock/index.json index f609241030..b485fbb55a 100644 --- a/esy.lock/index.json +++ b/esy.lock/index.json @@ -1,17 +1,17 @@ { - "checksum": "3c8b1af980087634890b5cb0aea5b450", + "checksum": "8dea6b83c2d82cbe9271b3aa8aa6ca2a", "root": "bs-platform@link-dev:./esy.json", "node": { - "ocaml@github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400@d41d8cd9": { + "ocaml@github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57@d41d8cd9": { "id": - "ocaml@github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400@d41d8cd9", + "ocaml@github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57@d41d8cd9", "name": "ocaml", "version": - "github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400", + "github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57", "source": { "type": "install", "source": [ - "github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400" + "github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57" ] }, "overrides": [], @@ -25,10 +25,10 @@ "source": { "type": "link-dev", "path": ".", "manifest": "esy.json" }, "overrides": [], "dependencies": [ - "ocaml@github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400@d41d8cd9" + "ocaml@github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57@d41d8cd9" ], "devDependencies": [ - "ocaml@github:bucklescript/ocaml:package.json#bf88fbf88d4e305bab82259def35a4492e475400@d41d8cd9" + "ocaml@github:Et7f3/ocaml:package.json#cee7129b58afcb987cc1741acf4a786414502a57@d41d8cd9" ] } } diff --git a/scripts/ninja.js b/scripts/ninja.js index bded5701e1..312bbd4d2d 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -1415,6 +1415,10 @@ build all: phony runtime others $stdlib test ` ); } else { + // ASK: should I change something in the other branch ? + // ASK: Do you want a less destructive way by generating a .ninja file to include + const snapshot_ninja = fs.readFileSync(path.join(jscompDir, "snapshot.ninja"), "utf8"); + fs.writeFileSync(path.join(jscompDir, "snapshot.ninja"), snapshot_ninja.replace(/^native_ocaml_path.*/m, "native_ocaml_path = " + (process.env.ESY === "true" ? path.join(process.env.OCAMLLIB, "/../..") : "../ocaml/")), "utf8"); writeFileAscii( path.join(jscompDir, "build.ninja"), `