From cc341254ce95ae14245aaee757852126e0a670b7 Mon Sep 17 00:00:00 2001 From: Ryan Newton Date: Sun, 27 Jan 2019 11:50:43 -0500 Subject: [PATCH] Tease apart COARSE_DOCKER/COARSE_NIX and STACK_DOCKER/STACK_NIX, but all need work to bring them back. --- .jenkins_script.sh | 12 ++++++++---- .nix_default_environment.txt | 2 +- .travis.yml | 9 +++++---- Jenkinsfile | 15 ++++++++++----- Makefile | 7 +++---- run_all_tests.sh | 19 +++++++++++++++++-- set_env.sh | 21 +++++++-------------- 7 files changed, 51 insertions(+), 34 deletions(-) diff --git a/.jenkins_script.sh b/.jenkins_script.sh index 530f6edad..15f8334d1 100755 --- a/.jenkins_script.sh +++ b/.jenkins_script.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# The major environment variables this uses are: +# * COARSE_DOCKER=1 : coarse-grained, "build/run everything inside Docker" +# * COARSE_NIX=1 : same for Nix + set -xe echo "Running on machine: "`hostname -a || echo env says $HOSTNAME` @@ -12,10 +16,10 @@ echo "Git commit depth: " top=`pwd` -# This testing mode assumes that nix/docker integration is OFF by default: +# This testing mode assumes that stack's own nix/docker integration is OFF by default: export STACKARGS="--no-system-ghc" -if [ "$DOCKER" == "1" ]; then +if [ "$COARSE_DOCKER" == "1" ]; then # Make bintree-bench image: cd $top/BintreeBench make docker @@ -24,10 +28,10 @@ if [ "$DOCKER" == "1" ]; then cd $top/ docker build -t tree-velocity . -elif [ "$USE_NIX" == "1" ]; then +elif [ "$COARSE_NIX" == "1" ]; then # Here by default we use a pinned version of the software ecosystem: - nix-shell --pure --command "USE_NIX=1 ./run_all_tests.sh $@" + nix-shell --pure --command "COARSE_NIX=1 ./run_all_tests.sh $@" else # HACK to get Jenkins to use proper Racket and GCC versions diff --git a/.nix_default_environment.txt b/.nix_default_environment.txt index 241e7b0c5..b7c945fc4 100644 --- a/.nix_default_environment.txt +++ b/.nix_default_environment.txt @@ -1 +1 @@ -https://github.com/NixOS/nixpkgs-channels/archive/0f73fef53a97ff68205715d6ab6c0362db95b32f.tar.gz +https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz diff --git a/.travis.yml b/.travis.yml index 6705fad4f..20957c532 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ sudo: required # Do not choose a language; we provide our own build tools. language: generic +# language: nix # Caching so the next build will be fast too. cache: @@ -25,14 +26,14 @@ addons: # Docker code env: - - - DOCKER=1 - - USE_NIX=1 + - STACK_DOCKER=1 +# - STACK_NIX=1 # Temporary: matrix: allow_failures: - - env: DOCKER=1 - - env: USE_NIX=1 + - env: STACK_DOCKER=1 +# - env: STACK_NIX=1 install: # Download and unpack the stack executable diff --git a/Jenkinsfile b/Jenkinsfile index 3a6f343dc..54c79157b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,19 +1,24 @@ pipeline { // This is designed to run on Cutter @ IU - agent { - label 'slurm' - } + // agent { + // label 'slurm' + // } triggers { // Try to create a webhook: pollSCM('') } + environment { + // COARSE_DOCKER='1' + // COARSE_NIX='1' + } + stages { stage('Build') { steps { - sh 'srun -N1 -t 1:00:00 --exclusive "./.jenkins_script.sh"' - // sh './.jenkins_script.sh' + // sh 'srun -N1 -t 1:00:00 --exclusive "./.jenkins_script.sh"' + sh './.jenkins_script.sh' } } } diff --git a/Makefile b/Makefile index 8c9b873aa..97f96ea13 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,6 @@ all: racket subst deps: cd deps/sexpr-1.3 && ./configure && $(MAKE) -subst: -# RRN: This makefile is gone. Was it ever there? -# cd ASTBenchmarks/substitution && $(MAKE) - racket: gibbon-lang SANDBOX=.racket_sandbox @@ -29,6 +25,7 @@ gibbon-lang: $(SANDBOX) $(SANDBOX): mkdir -p $@ +# -------------------------- NIX ---------------------------------- # Bring up a shell using a fixed, known-good software image. # - 51a83266d164195698f04468d90d2c6238ed3491 is a snapshot of nixos-17.03 channel on [2017.08.16] # - 09b9f7e7c496813f3ecd01c39a976ae3637e41e6 is a snapshot of nixos-17.03 on [2017.10.03] @@ -46,6 +43,8 @@ pure: head: head-shell head-shell: nix-shell --arg pkgs 'import {}' +# -------------------------- /NIX ---------------------------------- + # Aggressive clean of the working copy: clean: diff --git a/run_all_tests.sh b/run_all_tests.sh index c50eb60a1..06ca9858f 100755 --- a/run_all_tests.sh +++ b/run_all_tests.sh @@ -94,7 +94,22 @@ racket $top/ASTBenchmarks/kdTree-BenchMark/racket/traversal.gib STK="stack --allow-different-user" -if [ "$USE_NIX" == "1" ]; then +if [ "$STACK_DOCKER" == "1" ]; then + if [ "$COARSE_DOCKER" == "1" ]; then + echo "ERROR: cannot use stack --docker when already running in COARSE_DOCKER=1" + exit 1 + fi + STK+=" --docker " + +elif [ "$STACK_NIX" == "1" ]; then + if [ "$COARSE_NIX" == "1" ]; then + echo "ERROR: should not use stack --nix when already running in COARSE_NIX=1" + exit 1 + fi + STK+=" --nix " +fi + +if [ "$COARSE_NIX" == "1" ]; then STK+=" --system-ghc " else STK+=" --install-ghc " @@ -116,7 +131,7 @@ fi echo " Gibbon Compiler (2/2): compiler test suite" echo "--------------------------------------------" -# Turning of -j for now [2016.11.06] +# Turning off -j for now [2016.11.06] cd $top/gibbon-compiler # make answers $STK exec test-gibbon-examples -- -v2 diff --git a/set_env.sh b/set_env.sh index a0cc94829..d24edc857 100644 --- a/set_env.sh +++ b/set_env.sh @@ -1,6 +1,4 @@ # This file must be sourced with ". set_env.sh" or "source set_env.sh" -# -# Responds to env var DOCKER=1 when this script is sourced. if ! [ -d ./gibbon-compiler ]; then echo "Error: please source this handy set_env script from the directory that contains it."; @@ -10,15 +8,11 @@ fi export GIBBONDIR=`pwd` export PLTADDONDIR=$GIBBONDIR/.racket_sandbox/ -if [ "$DOCKER" == "1" ]; then - STK="stack --docker " -else - STK="stack" -fi +STK="stack" BUILD_ARGS=" --install-ghc build " # A shortcut to make things easier: -function tc() { +function gib() { cur=`pwd` cd $GIBBONDIR/gibbon-compiler/ $STK $BUILD_ARGS @@ -42,24 +36,23 @@ function tc() { # WARNING: as of stack 1.2 you need to stack-clean between using # tc/tcd. It is not smart enough to rebuild automatically and keep # the build artifacts separate. -function tcd() { - BUILD_ARGS="$BUILD_ARGS --trace" tc $@ +function gib_dbg() { + BUILD_ARGS="$BUILD_ARGS --trace" gib $@ } # Nix version function gibn() { - STK="stack --nix" tc $@ + STK="stack --nix" gib $@ } function gibd() { # --docker-auto-pull isn't working: (cd $GIBBONDIR/gibbon-compiler/ && stack docker pull 2> /dev/null) && \ - STK="stack --docker " tc $@ + STK="stack --docker " gib $@ } - # A quick verison that doesn't check for recompile. -function tcq() { +function gibq() { cur=`pwd` cd $GIBBONDIR/gibbon-compiler/ CMD=`stack exec -- which gibbon`