From 18f8766d911da4ea96b32f1118fa1d1b178b2802 Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Mon, 3 Apr 2017 19:50:05 +0200 Subject: [PATCH] Run builds using CircleCI 2.0 in an Alpine 3.5 container (#21) * Support non-coreutils /bin/mktemp The template parameter is a coreutils extension and e.g. not available in busybox Test if we need it and use it only, if necessary * Run builds using CircleCI 2.0 in an Alpine 3.5 container Requires aaa798536bb65b240e4cae5eb34275e64e638a66 and ed9b4fd89cba9fb6dfa870ad5b358cbe129f74d6 to pass tests --- .circleci/config.yml | 20 ++++++++++++++++++++ circle.yml | 13 ------------- src/circleci-matrix.sh | 8 ++++++-- 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..a2fa7d0 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,20 @@ +version: 2 +jobs: + build: + working_directory: /circleci-matrix + docker: + - image: docker.io/library/alpine:3.5 + steps: + - checkout + - run: + name: Install dependencies + command: | + apk add --no-cache bash ca-certificates ncurses wget + wget -O bats-0.4.0.tar.gz https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz + tar -xzf bats-0.4.0.tar.gz + cd bats-0.4.0 + ./install.sh /usr/local + - run: + name: Run tests + command: bats tests/run.bats + diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 11bad88..0000000 --- a/circle.yml +++ /dev/null @@ -1,13 +0,0 @@ -machine: - environment: - XCODE_SCHEME: ignoreMe - XCODE_WORKSPACE: ignoreMe - -dependencies: - override: - - brew install bats - -test: - override: - - bats tests/run.bats - - bats tests/installer.bats diff --git a/src/circleci-matrix.sh b/src/circleci-matrix.sh index 6c8e6f8..617856f 100755 --- a/src/circleci-matrix.sh +++ b/src/circleci-matrix.sh @@ -11,6 +11,10 @@ TERMINAL_COLUMNS=$(tput cols || true) export CIRCLE_NODE_TOTAL=${CIRCLE_NODE_TOTAL:-1} export CIRCLE_NODE_INDEX=${CIRCLE_NODE_INDEX:-0} +if ! rm $(mktemp -t) ; then + MKTEMP_T_ARG=circleci_matrix.XXX +fi + error() { local message=$1 echo >&2 "ERROR: $message" @@ -182,7 +186,7 @@ read_file() { process_commands() { local line="" local envfile=$1 - local tempfile=$(mktemp -t circleci_matrix.XXX) + local tempfile=$(mktemp -t ${MKTEMP_T_ARG}) while read -r line; do cp -f "$envfile" "$tempfile" @@ -207,7 +211,7 @@ process_commands() { process_envs() { local line="" local i=0 - local tempfile=$(mktemp -t circleci_matrix.XXX) + local tempfile=$(mktemp -t ${MKTEMP_T_ARG}) local sources_prefix="$(sources)" while read -r line; do