diff --git a/.circleci/config.yml b/.circleci/config.yml index 8867fb6b..4c88ec55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,44 +1,24 @@ version: 2 +defaults: &defaults + working_directory: ~/ledger-live-desktop + docker: + - image: circleci/node:8.11.3-stretch-browsers + jobs: build: - docker: - - image: circleci/node:8.11.3-stretch-browsers - branches: - ignore: - - gh-pages + <<: *defaults steps: - checkout - restore_cache: - name: Restore Yarn Package Cache keys: - - v2-yarn-packages-{{ checksum "yarn.lock" }} - - run: - name: Install Dependencies - command: bash scripts/install-ci-deps.sh + - v7-yarn-packages-{{ checksum "yarn.lock" }} + - run: yarn install - save_cache: - name: Save Yarn Package Cache - key: v2-yarn-packages-{{ checksum "yarn.lock" }} + key: v7-yarn-packages-{{ checksum "yarn.lock" }} paths: - - node_modules/ - - run: - name: Lint - command: yarn lint - - run: - name: Prettier - command: ./node_modules/.bin/prettier -l "{src,webpack,.storybook}/**/*.js" - - run: - name: Flow - command: yarn flow --quiet - # - run: - # name: Test - # command: yarn test - # - run: - # name: Build - # command: yarn dist:dir - # - run: - # name: Generate build stats - # command: "du -h dist | sort -h > /tmp/build-stats.txt" - # - store_artifacts: - # path: /tmp/build-stats.txt - # destination: build-stats.txt + - node_modules + - run: yarn lint + - run: ./node_modules/.bin/prettier -l "{src,webpack,.storybook,static/i18n}/**/*.js" + - run: yarn flow --quiet + - run: yarn release diff --git a/scripts/dist.sh b/scripts/dist.sh index b56ad972..109af19d 100755 --- a/scripts/dist.sh +++ b/scripts/dist.sh @@ -2,6 +2,8 @@ set -e +export JOBS=max + # shellcheck disable=SC1091 source scripts/helpers/run-job.sh diff --git a/scripts/install-ci-deps.sh b/scripts/install-ci-deps.sh deleted file mode 100755 index fa375466..00000000 --- a/scripts/install-ci-deps.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# shellcheck disable=SC1091 -source scripts/helpers/hash.sh - -yarnLockHash=$(md5sum package.json | cut -d ' ' -f 1) -cachedYarnLockHash=$(getHash 'yarn.lock') - -if [ "$cachedYarnLockHash" == "$yarnLockHash" ]; then - echo "> Skipping yarn install" -else - yarn install - setHash 'yarn.lock' "$yarnLockHash" -fi diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh index 37cf824b..0d302214 100755 --- a/scripts/postinstall.sh +++ b/scripts/postinstall.sh @@ -2,6 +2,8 @@ set -e +export JOBS=max + # shellcheck disable=SC1091 source scripts/helpers/display-env.sh # shellcheck disable=SC1091 @@ -17,7 +19,7 @@ function main { # native dependencies - if [ "$CI" != "true" ] && hashDiffers yarn.lock "$(getYarnHash)"; then + if hashDiffers yarn.lock "$(getYarnHash)"; then rebuildElectronNativeDeps else formatSkip "native module build" "already up-to-date" diff --git a/scripts/release.sh b/scripts/release.sh index dcd4e56a..fb3afae7 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -8,6 +8,16 @@ source scripts/helpers/run-job.sh # shellcheck disable=SC1091 source scripts/helpers/display-env.sh +if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then + echo "You are not on master. Exiting properly. (CI)" + exit 0 +fi + +if ! git describe --exact-match --tags 2>/dev/null >/dev/null; then + echo "You are not on a tag. Exiting properly. (CI)" + exit 0 +fi + if [ -z "$GH_TOKEN" ]; then echo "GH_TOKEN is unset. can't release" >&2 exit 1