Browse Source

Use CircleCI to automate Linux deployment. Clean CI config.

master
meriadec 7 years ago
parent
commit
9f3c918253
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 48
      .circleci/config.yml
  2. 2
      scripts/dist.sh
  3. 14
      scripts/install-ci-deps.sh
  4. 4
      scripts/postinstall.sh
  5. 10
      scripts/release.sh

48
.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

2
scripts/dist.sh

@ -2,6 +2,8 @@
set -e
export JOBS=max
# shellcheck disable=SC1091
source scripts/helpers/run-job.sh

14
scripts/install-ci-deps.sh

@ -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

4
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"

10
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

Loading…
Cancel
Save