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 version: 2
jobs: defaults: &defaults
build: working_directory: ~/ledger-live-desktop
docker: docker:
- image: circleci/node:8.11.3-stretch-browsers - image: circleci/node:8.11.3-stretch-browsers
branches:
ignore: jobs:
- gh-pages build:
<<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
name: Restore Yarn Package Cache
keys: keys:
- v2-yarn-packages-{{ checksum "yarn.lock" }} - v7-yarn-packages-{{ checksum "yarn.lock" }}
- run: - run: yarn install
name: Install Dependencies
command: bash scripts/install-ci-deps.sh
- save_cache: - save_cache:
name: Save Yarn Package Cache key: v7-yarn-packages-{{ checksum "yarn.lock" }}
key: v2-yarn-packages-{{ checksum "yarn.lock" }}
paths: paths:
- node_modules/ - node_modules
- run: - run: yarn lint
name: Lint - run: ./node_modules/.bin/prettier -l "{src,webpack,.storybook,static/i18n}/**/*.js"
command: yarn lint - run: yarn flow --quiet
- run: - run: yarn release
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

2
scripts/dist.sh

@ -2,6 +2,8 @@
set -e set -e
export JOBS=max
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source scripts/helpers/run-job.sh 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 set -e
export JOBS=max
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source scripts/helpers/display-env.sh source scripts/helpers/display-env.sh
# shellcheck disable=SC1091 # shellcheck disable=SC1091
@ -17,7 +19,7 @@ function main {
# native dependencies # native dependencies
if [ "$CI" != "true" ] && hashDiffers yarn.lock "$(getYarnHash)"; then if hashDiffers yarn.lock "$(getYarnHash)"; then
rebuildElectronNativeDeps rebuildElectronNativeDeps
else else
formatSkip "native module build" "already up-to-date" 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 # shellcheck disable=SC1091
source scripts/helpers/display-env.sh 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 if [ -z "$GH_TOKEN" ]; then
echo "GH_TOKEN is unset. can't release" >&2 echo "GH_TOKEN is unset. can't release" >&2
exit 1 exit 1

Loading…
Cancel
Save