Skip to content

Set up CI with Azure Pipelines #3910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
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
8 changes: 0 additions & 8 deletions 4061.json

This file was deleted.

166 changes: 166 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

jobs:
- job: Linux_npm_install
pool:
vmImage: ubuntu-16.04

steps:
- bash: |
BS_TRAVIS_CI=1
OCAMLRUNPARAM="b"
echo "##vso[task.setvariable variable=BS_TRAVIS_CI]$BS_TRAVIS_CI"
echo "##vso[task.setvariable variable=OCAMLRUNPARAM]$OCAMLRUNPARAM"
displayName: "Set BS_TRAVIS_CI and OCAMLRUNPARAM"

- bash: env
displayName: "Print environment"

- script: |
git submodule init
git submodule update
displayName: "Pull Submodules"

- script: |
npm install
displayName: "npm install"

- bash: |
export BS_TRAVIS_CI=1
npm test
displayName: "test"

- job: macOS_npm_install
pool:
vmImage: macOS-10.13

steps:
- bash: |
BS_TRAVIS_CI=1
OCAMLRUNPARAM="b"
echo "##vso[task.setvariable variable=BS_TRAVIS_CI]$BS_TRAVIS_CI"
echo "##vso[task.setvariable variable=OCAMLRUNPARAM]$OCAMLRUNPARAM"
displayName: "Set BS_TRAVIS_CI and OCAMLRUNPARAM"

- bash: env
displayName: "Print environment"

- script: |
git submodule init
git submodule update
displayName: "Pull Submodules"

- script: |
npm install
displayName: "npm install"

- bash: |
export BS_TRAVIS_CI=1
npm test
displayName: "test"

- job: Windows_esy_build
pool:
vmImage: vs2017-win2016

steps:
# - bash: |
# echo "which x86_64-w64-mingw32-gcc"
# which x86_64-w64-mingw32-gcc
# "echo ls -l /c/ProgramData/Chocolatey/bin"
# ls -l /c/ProgramData/Chocolatey/bin
# echo "int main() { return 0; }" >test.c
# echo "x86_64-w64-mingw32-gcc -v test.c"
# x86_64-w64-mingw32-gcc -v test.c
# # echo "esy b which x86_64-w64-mingw32-as"
# # esy b which x86_64-w64-mingw32-as

# displayName: "find mingw"

- bash: |
BS_TRAVIS_CI=1
OCAMLRUNPARAM="b"
echo "##vso[task.setvariable variable=BS_TRAVIS_CI]$BS_TRAVIS_CI"
echo "##vso[task.setvariable variable=OCAMLRUNPARAM]$OCAMLRUNPARAM"
displayName: "Set BS_TRAVIS_CI and OCAMLRUNPARAM"

- bash: env
displayName: "Print environment"

# - script: |
# git submodule init
# git submodule update
# displayName: "Pull Submodules"

- script: npm install -g esy
displayName: "install esy"
- script: esy install
displayName: "esy install"
- script: esy build
displayName: "esy build"

# - bash: |
# OCAMLOPT=`esy b which ocamlopt`
# OCAMLBIN_UNIX=$(dirname "${OCAMLOPT}")
# OCAMLBIN=$( cygpath --windows "$OCAMLBIN_UNIX")
# echo "OCAMLBIN: $OCAMLBIN"
# echo "##vso[task.setvariable variable=OCAMLBIN]$OCAMLBIN"
# echo "##vso[task.prependpath]$OCAMLBIN"
# displayName: "Set OCAMLBIN"

# - bash: env
# displayName: "Print environment"

# - bash: ls -lR "$OCAMLBIN"
# displayName: "ls -lR $OCAMLBIN"

# - bash: ls -lR "$OCAMLBIN/.."
# displayName: "ls -lR $OCAMLBIN/.."

# - bash: |
# echo "PATH"
# echo $PATH
# echo "ocamlopt -version"
# ocamlopt -version
# echo "looking for x86_64-w64-mingw32-as"
# find ~/.esy -name "x86_64-w64-mingw32-as*"
# echo "print_int 42;; print_newline();;" >testOcaml.ml
# echo "build with esy"
# esy b ocamlopt.opt -verbose testOcaml.ml -o testOcaml
# ./testOcaml
# echo "build without esy"
# ocamlopt.opt testOcaml.ml -o testOcaml
# node scripts/prebuilt.js
# displayName: "try node scripts/prebuilt.js"

- job: Linux_esy_build
pool:
vmImage: ubuntu-16.04
steps:
- bash: env
displayName: "Print environment"
- script: npm install -g esy
displayName: "install esy"
- script: esy install
displayName: "esy install"
- script: esy build
displayName: "esy build"

- job: macOS_esy_build
pool:
vmImage: macOS-10.13
steps:
- bash: env
displayName: "Print environment"
- script: npm install -g esy
displayName: "install esy"
- script: esy install
displayName: "esy install"
- script: esy build
displayName: "esy build"
7 changes: 2 additions & 5 deletions esy.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"name": "bs-platform",
"version": "5.2.0-dev.2",
"dependencies": {
"ocaml": "4.02.3000+BS"
},
"devDependencies": {
"ocaml": "4.02.3000+BS"
"ocaml": "overridden below"
},
"resolutions": {
"ocaml": "bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb"
"ocaml": "ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2"
},
"scripts": {
"clean": "node ./scripts/ninja.js clean"
Expand Down
16 changes: 7 additions & 9 deletions esy.lock/index.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"checksum": "a0f4fa67bcb1beac6cda121fffdda6bb",
"checksum": "8a97123dcb14bb7cb79bfd0219cb97fa",
"root": "bs-platform@link-dev:./esy.json",
"node": {
"ocaml@github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb@d41d8cd9": {
"ocaml@github:ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2@d41d8cd9": {
"id":
"ocaml@github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb@d41d8cd9",
"ocaml@github:ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2@d41d8cd9",
"name": "ocaml",
"version":
"github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb",
"github:ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2",
"source": {
"type": "install",
"source": [
"github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb"
"github:ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2"
]
},
"overrides": [],
Expand All @@ -24,11 +24,9 @@
"version": "link-dev:./esy.json",
"source": { "type": "link-dev", "path": ".", "manifest": "esy.json" },
"overrides": [],
"dependencies": [
"ocaml@github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb@d41d8cd9"
],
"dependencies": [],
"devDependencies": [
"ocaml@github:bucklescript/ocaml:package.json#698e60f3cd2f442f2013e79860ce2f7b0a9624cb@d41d8cd9"
"ocaml@github:ulrikstrid/ocaml:package.json#6ff2cd84ddc7e8bbebd437a7695d04e4ba0900c2@d41d8cd9"
]
}
}
Expand Down
3 changes: 1 addition & 2 deletions jscomp/snapshot.ninja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rule bspack
generator = true


NATIVE_OCAML_PATH=../ocaml/
NATIVE_OCAML_PATH=$native_ocaml_path

OCAML_SRC_UTILS=$NATIVE_OCAML_PATH/utils
OCAML_SRC_PARSING=$NATIVE_OCAML_PATH/parsing
Expand Down Expand Up @@ -71,4 +71,3 @@ build $SNAP/unstable/js_compiler.ml: bspack | ./bin/bspack.exe
# command = $ocamlopt -w -a unix.cmxa str.cmxa ./stubs/ext_basic_hash_stubs.c $in -o $out
# only check if it compiles
# build $SNAP/unstable/bsb_native.exe: bsbnative ./bin/bsb_native.ml

4 changes: 2 additions & 2 deletions scripts/ciTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if (all){
installGlobal = true
ounitTest = true
mochaTest = true
themeTest = true
bsbTest = true
// themeTest = true
// bsbTest = true
Copy link
Member

Choose a reason for hiding this comment

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

This does not work because npm link does not work under Azure?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes that's my guess. I think links in general are problematic.
So I'm skipping this for now as I'm more interested in getting Windows to work.
The other observation is that CircleCI is definitely faster on Linux.

}

var os = require('os')
Expand Down
5 changes: 5 additions & 0 deletions scripts/ninja.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,11 @@ build all: phony runtime others $stdlib test
`
${getVendorConfigNinja()}
stdlib = ${version6() ? `stdlib-406` : `stdlib-402`}
native_ocaml_path = ${
process.env.ESY === "true"
? path.join(process.env.OCAMLLIB, "/../..")
: "../ocaml/"
}
snapshot_path = ${require("./buildocaml.js").getVersionPrefix()}
subninja compiler.ninja
subninja snapshot.ninja
Expand Down
10 changes: 5 additions & 5 deletions scripts/prebuilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function buildCompiler() {
var prebuilt = "prebuilt.ninja";
var content = require("./ninjaFactory.js").libNinja({
ocamlopt: is_windows
? `ocamlopt.opt.exe`
? `esy b ocamlopt.opt -verbose`
: `../native/${ocamlVersion}/bin/ocamlopt.opt`,
ext: sys_extension,
INCL: ocamlVersion,
Expand All @@ -58,10 +58,10 @@ var os = require("os");
function createOCamlTar() {
if (os.platform() === hostPlatform) {
cp.execSync(`git -C ocaml status -uno`, { cwd: root, stdio: [0, 1, 2] });
cp.execSync(
`git -C ocaml archive --format=tar.gz HEAD -o ../vendor/ocaml.tar.gz`,
{ cwd: root, stdio: [0, 1, 2] }
);
// cp.execSync(
// `git -C ocaml archive --format=tar.gz HEAD -o ../vendor/ocaml.tar.gz`,
// { cwd: root, stdio: [0, 1, 2] }
// );
// fs.copyFileSync(
// path.join(root, "ocaml", "VERSION"),
// path.join(root, "OCAML_VERSION")
Expand Down