Skip to content

Instantly share code, notes, and snippets.

@ymtszw
Last active November 15, 2018 09:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymtszw/bfef21f2297ec08041a45953538f417f to your computer and use it in GitHub Desktop.
Save ymtszw/bfef21f2297ec08041a45953538f417f to your computer and use it in GitHub Desktop.
CI speedup workaround scripts for Elm 0.18 (see https://github.com/elm-lang/elm-compiler/issues/1473 for details)
sudo: false
os:
- linux
language: node_js
node_js:
- "6"
- "8"
cache:
directories:
- "sysconfcpus"
- "node_modules"
- "elm-stuff"
- "tests/elm-stuff"
before_install:
- ./scripts/ci/ensure_libsysconfcpus.sh
before_script:
- ./scripts/ci/replace_elm_make.sh 2
# .circleci/config.yml for CircleCI 2.0
version: 2
jobs:
node6:
docker:
- image: circleci/node:6
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v6-dependencies-{{ checksum "package.json" }}-{{ checksum "elm-package.json" }}
- v6-dependencies-
- run: ./scripts/ci/ensure_libsysconfcpus.sh
- run: npm install
- run: ./scripts/ci/replace_elm_make.sh 1
- run: npm test
- save_cache:
paths:
- sysconfcpus
- node_modules
- elm-stuff
- tests/elm-stuff
key: v6-dependencies-{{ checksum "package.json" }}-{{ checksum "elm-package.json" }}
node8:
docker:
- image: circleci/node:8
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v8-dependencies-{{ checksum "package.json" }}-{{ checksum "elm-package.json" }}
- v8-dependencies-
- run: ./scripts/ci/ensure_libsysconfcpus.sh
- run: npm install
- run: ./scripts/ci/replace_elm_make.sh 1
- run: npm test
- save_cache:
paths:
- sysconfcpus
- node_modules
- elm-stuff
- tests/elm-stuff
key: v8-dependencies-{{ checksum "package.json" }}-{{ checksum "elm-package.json" }}
workflows:
version: 2
build:
jobs:
- node6
- node8
#!/usr/bin/env bash
set -eu
cwd=$(pwd)
if [ ! -d sysconfcpus/bin ]; then
git clone https://github.com/obmarg/libsysconfcpus.git
pushd libsysconfcpus
./configure --prefix="${cwd}/sysconfcpus"
make && make install
popd
fi
#!/usr/bin/env bash
# replace normal elm-make with sysconfcpus-prefixed elm-make
# epic build time improvement - see https://github.com/elm-lang/elm-compiler/issues/1473#issuecomment-245704142
set -euo pipefail
ncore=${1:-1}
if ! grep "sysconfcpus -n ${ncore}" "$(npm bin)/elm-make"; then
if [ ! -f "$(npm bin)/elm-make-old" ]; then
mv "$(npm bin)/elm-make" "$(npm bin)/elm-make-old"
fi
cat << EOF > "$(npm bin)/elm-make"
#!/usr/bin/env bash
set -eu
echo "Running elm-make with sysconfcpus -n ${ncore}"
$(pwd)/sysconfcpus/bin/sysconfcpus -n ${ncore} "$(npm bin)/elm-make-old" "\$@"
EOF
chmod +x "$(npm bin)/elm-make"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment