From bf4a8d4b3dead30fb9360b7f66b0de0f3977e420 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 21 Oct 2021 13:41:20 +0200 Subject: [PATCH 1/3] Dirty hack to honour [circle ci] --- .circleci/config.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ca5f6c8c1..5f076f7765 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,23 +16,49 @@ defaults: &defaults keys: - v4-stack-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }} + - run: + name: Skip ci setup + command: | + set +e + echo $CIRCLE_PULL_REQUEST + if [[ ! -z $CIRCLE_PULL_REQUEST ]]; then + PULL_REQUEST_URL=${CIRCLE_PULL_REQUEST/github.com/api.github.com/repos} + PULL_REQUEST_URL=${PULL_REQUEST_URL/pull/pulls} + echo $PULL_REQUEST_URL + SKIP_CI=$(curl $PULL_REQUEST_URL | grep -o "\\[skip ci\\]") + echo $SKIP_CI + fi + echo "export SKIP_CI=$SKIP_CI" >> $BASH_ENV + - run: name: Stack upgrade - command: stack upgrade + command: | + if [[ -z "$SKIP_CI" ]]; then + stack upgrade + fi - run: name: Stack setup - command: stack -j2 --stack-yaml=${STACK_FILE} setup + command: | + if [[ -z "$SKIP_CI" ]]; then + stack -j2 --stack-yaml=${STACK_FILE} setup + fi - run: name: Build (we need the exe for tests) # need j1, else ghc-lib-parser triggers OOM - command: stack -j1 --stack-yaml=${STACK_FILE} install --no-terminal + command: | + if [[ -z "$SKIP_CI" ]]; then + stack -j1 --stack-yaml=${STACK_FILE} install --no-terminal + fi no_output_timeout: 30m - run: name: Build Testsuite without running it - command: stack -j1 --stack-yaml=${STACK_FILE} build --test --no-run-tests --no-terminal + command: | + if [[ -z "$SKIP_CI" ]]; then + stack -j1 --stack-yaml=${STACK_FILE} build --test --no-run-tests --no-terminal + fi no_output_timeout: 30m - store_artifacts: From dfef2f6c4b8f03d64563a1d524463f8d8bc75f7a Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 21 Oct 2021 14:08:04 +0200 Subject: [PATCH 2/3] Show vars name in echos --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f076f7765..16c5e057dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,13 +20,13 @@ defaults: &defaults name: Skip ci setup command: | set +e - echo $CIRCLE_PULL_REQUEST + echo "CIRCLE_PULL_REQUEST: $CIRCLE_PULL_REQUEST" if [[ ! -z $CIRCLE_PULL_REQUEST ]]; then PULL_REQUEST_URL=${CIRCLE_PULL_REQUEST/github.com/api.github.com/repos} PULL_REQUEST_URL=${PULL_REQUEST_URL/pull/pulls} - echo $PULL_REQUEST_URL + echo "PULL_REQUEST_URL: $PULL_REQUEST_URL" SKIP_CI=$(curl $PULL_REQUEST_URL | grep -o "\\[skip ci\\]") - echo $SKIP_CI + echo "SKIP_CI: $SKIP_CI" fi echo "export SKIP_CI=$SKIP_CI" >> $BASH_ENV From c760d91c8c6576764ff355d03d2304a6e408214b Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Fri, 22 Oct 2021 11:16:42 +0200 Subject: [PATCH 3/3] Add comment about the hack --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16c5e057dc..0ce6ca2740 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,7 @@ defaults: &defaults keys: - v4-stack-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }} + # Looking for the string [skip ci] in all the json returned by https://docs.github.com/en/rest/reference/pulls#get-a-pull-request - run: name: Skip ci setup command: |