From e0b5910627ffeeb3ad85d312c507dd13b6898645 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Sat, 7 Sep 2019 13:52:00 -0700 Subject: [PATCH 1/5] Try to fix CI again --- .gitlab-ci.yml | 27 +++++-------------- docker/Dockerfile | 17 +++++------- scripts/build_ligo_local.sh | 2 +- scripts/debug_show_versions.sh | 8 ------ scripts/install_ligo_with_dependencies.sh | 5 ---- scripts/install_vendors_deps.sh | 10 ++----- scripts/setup_dev_switch.sh | 1 + scripts/setup_repos.sh | 6 +++++ scripts/setup_switch.sh | 9 ------- src/dune-project | 2 +- src/parser/camligo/dune | 10 +++++-- src/parser/ligodity/dune | 6 ++--- src/parser/shared/dune | 2 +- .../proto-alpha-utils/proto-alpha-utils.opam | 7 +++-- 14 files changed, 40 insertions(+), 72 deletions(-) delete mode 100755 scripts/debug_show_versions.sh delete mode 100755 scripts/install_ligo_with_dependencies.sh create mode 100755 scripts/setup_repos.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ab62674f..fd988aca4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ stages: - test .website_build: &website_build - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_and_deploy_website + stage: build_and_deploy_website image: node:8 before_script: - scripts/install_native_dependencies.sh @@ -18,18 +18,12 @@ stages: - eval $(opam config env) - scripts/setup_switch.sh - eval $(opam config env) - - scripts/debug_show_versions.sh || true + - scripts/setup_repos.sh # install deps for internal documentation - - opam install -y odoc - # - vendors/opam-repository-tools/rewrite-local-opam-repository.sh - # - opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" - scripts/install_vendors_deps.sh + - opam install -y odoc - scripts/build_ligo_local.sh - # - opam install -y --build-test --deps-only ./src/ - # - dune build -p ligo - # TODO: also try instead from time to time: - #- (cd ./src/; dune build -p ligo) # build with odoc - dune build @doc @@ -67,14 +61,10 @@ stages: - scripts/install_native_dependencies.sh - scripts/install_opam.sh # TODO: or scripts/install_build_environment.sh ? - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" - - echo "$PATH"; which ocaml || true - eval $(opam config env) - - echo "$PATH"; which ocaml || true - scripts/setup_switch.sh - - echo "$PATH"; which ocaml || true - eval $(opam config env) - - echo "$PATH"; which ocaml || true - - scripts/debug_show_versions.sh || true + - scripts/setup_repos.sh local-dune-job: <<: *before_script @@ -115,7 +105,7 @@ remote-repo-job: # Run a docker build without publishing to the registry build-current-docker-image: - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_docker + stage: build_docker <<: *docker <<: *docker_build except: @@ -125,7 +115,7 @@ build-current-docker-image: # When a MR/PR is merged to dev # take the previous build and publish it to Docker Hub build-and-publish-latest-docker-image: - stage: test # TODO DODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODODO restore to build_and_deploy_docker + stage: build_and_deploy_docker <<: *docker <<: *docker_build after_script: @@ -133,9 +123,6 @@ build-and-publish-latest-docker-image: - docker push $LIGO_REGISTRY_IMAGE:next only: - dev - - refactor/new-tezos-deps-ci - - refactor/new-tezos-deps-cicliexe - # Pages are deployed from both master & dev, be careful not to override 'next' # in case something gets merged into 'dev' while releasing. @@ -144,5 +131,3 @@ pages: only: - master - dev - - refactor/new-tezos-deps-ci - - refactor/new-tezos-deps-cicliexe diff --git a/docker/Dockerfile b/docker/Dockerfile index a67504209..057bd6436 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,5 @@ -# We could use one of the nomadiclab's docker images as a base instead -# We're using 4.06 instead of 4.06.1, if this causes problems build a custom 4.06.1 image instead -FROM ocaml/opam2:4.06 +# At the moment, this really means 4.07.1 +FROM ocaml/opam2:4.07 USER root @@ -23,18 +22,14 @@ RUN sh scripts/install_native_dependencies.sh # TODO: or scripts/install_build_environment.sh ? RUN sh scripts/install_opam.sh -# Creat opam switch -RUN sh scripts/setup_switch.sh +# Add tezos repository +RUN sh scripts/setup_repos.sh RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN sh -c pwd -RUN sh scripts/build_ligo_local.sh -RUN sh -c pwd -RUN ls -l -RUN sh -c 'ls -l /ligo/_build/default/src/bin/cli.exe || true' +RUN opam install -y ./src # Use the ligo binary as a default command -ENTRYPOINT [ "/ligo/_build/default/src/bin/cli.exe" ] +ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh index 8ccfd8658..b78e4ffd6 100755 --- a/scripts/build_ligo_local.sh +++ b/scripts/build_ligo_local.sh @@ -2,7 +2,7 @@ set -e eval $(opam config env) -dune build src # TODO: make it work with -p ligo +dune build -p ligo # TODO: also try instead from time to time: #- (cd ./src/; dune build -p ligo) diff --git a/scripts/debug_show_versions.sh b/scripts/debug_show_versions.sh deleted file mode 100755 index 1c744a566..000000000 --- a/scripts/debug_show_versions.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -echo "$PATH" -opam --version -printf '' | ocaml -opam switch - diff --git a/scripts/install_ligo_with_dependencies.sh b/scripts/install_ligo_with_dependencies.sh deleted file mode 100755 index 78e5d8b62..000000000 --- a/scripts/install_ligo_with_dependencies.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -set -e - -cd src -opam install . --yes diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 9d2035b45..4c07cf691 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -2,11 +2,5 @@ set -e # Install local dependencies -opam install -y ./vendors/ligo-utils/simple-utils -opam install -y ./vendors/ligo-utils/tezos-protocol-alpha -opam install -y ./vendors/ligo-utils/tezos-protocol-alpha-parameters -opam install -y ./vendors/ligo-utils/memory-proto-alpha -opam install -y ./vendors/ligo-utils/tezos-utils/michelson-parser -opam install -y ./vendors/ligo-utils/tezos-utils -opam install -y ./vendors/ligo-utils/proto-alpha-utils -opam install -y getopt ppx_deriving menhir +opam install -y --deps-only $(find src vendors -name \*.opam) +opam install -y $(find vendors -name \*.opam) diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh index 88662c79a..e4cd196cb 100755 --- a/scripts/setup_dev_switch.sh +++ b/scripts/setup_dev_switch.sh @@ -2,6 +2,7 @@ set -e "$(dirname "$0")"/setup_switch.sh +"$(dirname "$0")"/setup_repos.sh opam install -y ocp-indent tuareg merlin alcotest-lwt crowbar opam -y user-setup install diff --git a/scripts/setup_repos.sh b/scripts/setup_repos.sh new file mode 100755 index 000000000..ae085d353 --- /dev/null +++ b/scripts/setup_repos.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +set -x + +eval $(opam config env) +opam repo add tezos-opam-repository https://gitlab.com/nomadic-labs/tezos-opam-repository.git diff --git a/scripts/setup_switch.sh b/scripts/setup_switch.sh index 070e720a7..ed1e839b2 100755 --- a/scripts/setup_switch.sh +++ b/scripts/setup_switch.sh @@ -4,12 +4,3 @@ set -x printf '' | opam switch create . 4.07.1 # toto ocaml-base-compiler.4.06.1 eval $(opam config env) - -# Add Tezos opam repository -opam repo add tezos-opam-repository https://gitlab.com/nomadic-labs/tezos-opam-repository.git - -# TODO: move this to install_vendor_deps.sh -# Pin the versions of some dependencies -opam pin -y zarith 1.7 -opam pin -y ipaddr 3.1.0 -opam pin -y macaddr 3.1.0 diff --git a/src/dune-project b/src/dune-project index 13109bb9b..ca4766b9c 100644 --- a/src/dune-project +++ b/src/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.6) +(lang dune 1.11) (using menhir 2.0) diff --git a/src/parser/camligo/dune b/src/parser/camligo/dune index 428f10424..01a68e5cb 100644 --- a/src/parser/camligo/dune +++ b/src/parser/camligo/dune @@ -28,7 +28,7 @@ (targets parser_generated.mly) (deps partial_parser.mly pre_parser.mly) (action (system "cat pre_parser.mly partial_parser.mly > parser_generated.mly")) - (mode promote-until-clean) + (mode (promote (until-clean) (only *))) ) (rule @@ -43,7 +43,7 @@ (targets ast_generated.ml) (deps generator.exe) (action (system "./generator.exe ast > ast_generated.ml")) - (mode promote-until-clean) + (mode (promote (until-clean) (only *))) ) ;; Generating Generator @@ -57,4 +57,10 @@ lex ) (modules generator) + (preprocess + (pps + ppx_let + ppx_deriving.std + ) + ) ) diff --git a/src/parser/ligodity/dune b/src/parser/ligodity/dune index 1d26b826f..db5d8a6bc 100644 --- a/src/parser/ligodity/dune +++ b/src/parser/ligodity/dune @@ -27,16 +27,16 @@ ; (targets Parser.exe) ; (deps ParserMain.exe) ; (action (copy ParserMain.exe Parser.exe)) -; (mode promote-until-clean)) +; (mode (promote (until-clean) (only *)))) ;(rule ; (targets Lexer.exe) ; (deps LexerMain.exe) ; (action (copy LexerMain.exe Lexer.exe)) -; (mode promote-until-clean)) +; (mode (promote (until-clean) (only *)))) (rule (targets Version.ml) (action (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) - (mode promote-until-clean)) + (mode (promote (until-clean) (only *)))) diff --git a/src/parser/shared/dune b/src/parser/shared/dune index 7e62da9a8..b9ec951ee 100644 --- a/src/parser/shared/dune +++ b/src/parser/shared/dune @@ -25,4 +25,4 @@ (targets Version.ml) (action (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) - (mode promote-until-clean)) \ No newline at end of file + (mode (promote (until-clean) (only *)))) diff --git a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam index 4a4e6cfc8..af3f7d9fe 100644 --- a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam +++ b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam @@ -18,7 +18,9 @@ depends: [ "ezjsonm" "hex" "hidapi" - "ipaddr" + # opam does not handle tezos' constraints well (why?) + "ipaddr" { >= "3.1.0" & < "4.0.0" } + "macaddr" { >= "3.1.0" & < "4.0.0" } "irmin" "js_of_ocaml" "lwt" @@ -31,7 +33,8 @@ depends: [ "stdio" "uri" "uutf" - "zarith" + # tezos does not constrain their required version + "zarith" {= "1.7"} "ocplib-json-typed" "ocplib-json-typed-bson" "tezos-crypto" From c867a4c4d4b38f92ed3e650429b01ab97068579d Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Mon, 9 Sep 2019 13:59:08 -0700 Subject: [PATCH 2/5] Remove dune-project files --- .gitignore | 2 +- src/dune-project | 2 -- vendors/ligo-utils/memory-proto-alpha/dune-project | 2 -- vendors/ligo-utils/proto-alpha-utils/dune-project | 1 - vendors/ligo-utils/simple-utils/dune-project | 1 - vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project | 2 -- vendors/ligo-utils/tezos-protocol-alpha/dune-project | 2 -- vendors/ligo-utils/tezos-utils/dune-project | 1 - vendors/ligo-utils/tezos-utils/michelson-parser/dune-project | 1 - 9 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 src/dune-project delete mode 100644 vendors/ligo-utils/memory-proto-alpha/dune-project delete mode 100644 vendors/ligo-utils/proto-alpha-utils/dune-project delete mode 100644 vendors/ligo-utils/simple-utils/dune-project delete mode 100644 vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project delete mode 100644 vendors/ligo-utils/tezos-protocol-alpha/dune-project delete mode 100644 vendors/ligo-utils/tezos-utils/dune-project delete mode 100644 vendors/ligo-utils/tezos-utils/michelson-parser/dune-project diff --git a/.gitignore b/.gitignore index 52f26081e..10c5583fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /_build/ -/dune-project +dune-project *~ cache/* Version.ml diff --git a/src/dune-project b/src/dune-project deleted file mode 100644 index ca4766b9c..000000000 --- a/src/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.11) -(using menhir 2.0) diff --git a/vendors/ligo-utils/memory-proto-alpha/dune-project b/vendors/ligo-utils/memory-proto-alpha/dune-project deleted file mode 100644 index 1cf86c9fe..000000000 --- a/vendors/ligo-utils/memory-proto-alpha/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.11) -(name tezos-memory-proto-alpha) diff --git a/vendors/ligo-utils/proto-alpha-utils/dune-project b/vendors/ligo-utils/proto-alpha-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/proto-alpha-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/simple-utils/dune-project b/vendors/ligo-utils/simple-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/simple-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project deleted file mode 100644 index 4afa89be6..000000000 --- a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.10) -(name tezos-protocol-alpha-parameters) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/dune-project b/vendors/ligo-utils/tezos-protocol-alpha/dune-project deleted file mode 100644 index 6d415f3bf..000000000 --- a/vendors/ligo-utils/tezos-protocol-alpha/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.10) -(name tezos-embedded-protocol-alpha) diff --git a/vendors/ligo-utils/tezos-utils/dune-project b/vendors/ligo-utils/tezos-utils/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/tezos-utils/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) diff --git a/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project b/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project deleted file mode 100644 index a26d6e273..000000000 --- a/vendors/ligo-utils/tezos-utils/michelson-parser/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.6) From e700c13897fa5f094d3c188adfbca565d28ffc00 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Mon, 9 Sep 2019 14:34:54 -0700 Subject: [PATCH 3/5] Makefile cleanup --- Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Makefile b/Makefile index 21dd72cc7..b11ce6fd8 100644 --- a/Makefile +++ b/Makefile @@ -10,20 +10,14 @@ install-deps: scripts/install_build_environment.sh # TODO: or scripts/install_opam.sh ? build-deps: - echo aa export PATH="/usr/local/bin$${PATH:+:}$${PATH:-}" # Create opam dev switch locally for use with Ligo, add merlin/etc if [ -n "`opam switch show | grep -P ".+/ligo"`" ]; then :; else scripts/setup_dev_switch.sh; fi - echo bb eval $$(opam config env) - echo cc # Install OCaml build dependencies for Ligo scripts/install_vendors_deps.sh - echo dd - scripts/install_ligo_with_dependencies.sh # TODO: rename & cleanup - echo ee build: build-deps export PATH="/usr/local/bin$${PATH:+:}$${PATH:-}" From b0b7fb7ac67c594fc56f8e67fceb6641b6ac9d9f Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Fri, 13 Sep 2019 13:20:40 +0000 Subject: [PATCH 4/5] Ligolang tezos repo --- scripts/install_vendors_deps.sh | 2 +- scripts/setup_repos.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 4c07cf691..3da674636 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -2,5 +2,5 @@ set -e # Install local dependencies -opam install -y --deps-only $(find src vendors -name \*.opam) +opam install -y --deps-only --with-test $(find src vendors -name \*.opam) opam install -y $(find vendors -name \*.opam) diff --git a/scripts/setup_repos.sh b/scripts/setup_repos.sh index ae085d353..e14c81707 100755 --- a/scripts/setup_repos.sh +++ b/scripts/setup_repos.sh @@ -3,4 +3,9 @@ set -e set -x eval $(opam config env) -opam repo add tezos-opam-repository https://gitlab.com/nomadic-labs/tezos-opam-repository.git + +# Remove the nomadic-labs tezos repo (from ligo switch only) +opam repository remove tezos-opam-repository + +# Add ligolang tezos repo +opam repository add ligolang-tezos-opam-repository https://gitlab.com/ligolang/tezos-opam-repository.git From cd645520f72b84a4156b1eea5034a28db5f1f2f0 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 20 Sep 2019 06:27:20 -0700 Subject: [PATCH 5/5] Fix outdated git repo link on versions page --- gitlab-pages/website/pages/en/versions.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gitlab-pages/website/pages/en/versions.js b/gitlab-pages/website/pages/en/versions.js index 4cc1bd3b5..6abeaa02e 100644 --- a/gitlab-pages/website/pages/en/versions.js +++ b/gitlab-pages/website/pages/en/versions.js @@ -18,15 +18,13 @@ const versions = require(`${CWD}/versions.json`); function Versions(props) { const {config: siteConfig} = props; const latestVersion = versions[0]; - const repoUrl = `https://github.com/${siteConfig.organizationName}/${ - siteConfig.projectName - }`; + const repoUrl = `${siteConfig.repoUrl}`; return (
-

{siteConfig.title} Versions

+

{siteConfig.title} Versions

Current version