Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions .github/workflows/print_esy_cache.js
Original file line number Diff line number Diff line change
@@ -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"));
8 changes: 0 additions & 8 deletions 4061.json

This file was deleted.

7 changes: 4 additions & 3 deletions esy.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "bs-platform",
"version": "7.2.0",
"version": "8.3.0-dev.2",
"dependencies": {
"ocaml": "4.6.1000+BS"
},
"devDependencies": {
"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}"],
Expand Down
14 changes: 7 additions & 7 deletions esy.lock/index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions scripts/ninja.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
`
Expand Down