Started using the scripts/… in .gitignore, started a Makefile for one-liners to be used by the devs, e.g. make build-deps, make, make test

This commit is contained in:
Georges Dupéron 2019-05-28 20:54:07 +02:00
parent fae35a1f42
commit 47409db7db
4 changed files with 26 additions and 15 deletions

View File

@ -37,18 +37,13 @@ stages:
# Install dependencies # Install dependencies
# rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam # rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam
- apt-get update -qq - apt-get update -qq
- apt-get -y -qq install rsync libhidapi-dev libcap-dev libev-dev bubblewrap - scripts/install_native_dependencies.sh
- wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O opam-2.0.1-x86_64-linux - scripts/install_opam.sh
- cp opam-2.0.1-x86_64-linux /usr/local/bin/opam
- chmod +x /usr/local/bin/opam
- export PATH="/usr/local/bin${PATH:+:}${PATH:-}" - export PATH="/usr/local/bin${PATH:+:}${PATH:-}"
# Initialise opam # Initialise opam, create switch, load opam environment variables
- printf '' | opam init --bare - printf '' | opam init --bare
- eval $(opam config env) - printf '' | opam switch create ligo-switch ocaml-base-compiler.4.06.1
# Create switch
- printf '' | opam switch create toto ocaml-base-compiler.4.06.1
- eval $(opam config env) - eval $(opam config env)
# Show versions and current switch # Show versions and current switch
@ -61,8 +56,7 @@ local-dune-job:
<<: *before_script <<: *before_script
stage: test stage: test
script: script:
- vendors/opam-repository-tools/rewrite-local-opam-repository.sh - scripts/setup_ligo_opam_repository.sh
- opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/"
- opam install -y --build-test --deps-only ./src/ - opam install -y --build-test --deps-only ./src/
- dune build -p ligo - dune build -p ligo
# TODO: also try instead from time to time: # TODO: also try instead from time to time:

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
build-deps:
scripts/install_native_dependencies.sh
scripts/install_opam.sh

View File

@ -1,10 +1,14 @@
#!/bin/bash #!/bin/sh
set -euET -o pipefail set -e
apt-get -y install \ apt-get update -qq
apt-get -y -qq install \
libev-dev \ libev-dev \
perl \ perl \
pkg-config \ pkg-config \
libgmp-dev \ libgmp-dev \
libhidapi-dev \ libhidapi-dev \
m4 m4 \
libcap-dev \
bubblewrap \
rsync

10
scripts/install_opam.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euET -o pipefail
# TODO: this has many different modes of failure (file temp.opam-2.0.1-x86_64-linux.download-in-progress already exists, /usr/local/bin/opam already exists and is a directory or hard link, …)
# Try to improve these aspects.
wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O temp.opam-2.0.1-x86_64-linux.download-in-progress
cp -i temp.opam-2.0.1-x86_64-linux.download-in-progress /usr/local/bin/opam
chmod +x /usr/local/bin/opam
rm temp.opam-2.0.1-x86_64-linux.download-in-progress