Skip to content

Commit

Permalink
Merge pull request #101 from marp-team/circleci-2.1
Browse files Browse the repository at this point in the history
Update CircleCI configuration to use v2.1
  • Loading branch information
yhatt authored Sep 6, 2019
2 parents 63885ac + 85b4d44 commit 11f2397
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 52 deletions.
127 changes: 76 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,66 @@
references:
base: &base
version: 2.1

executors:
node:
parameters:
version:
type: string
default: lts
docker:
- image: circleci/node:10.16.0
- image: circleci/node:<< parameters.version >>
working_directory: ~/marp-core
steps:
- run: node --version

commands:
install:
parameters:
postinstall:
type: steps
default: []
yarn:
type: string
default: 1.17.3
steps:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#upgradingdowngrading-yarn
- run:
name: Upgrade and configure yarn
name: Upgrade yarn
command: |
sudo -E sh -c 'curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz'
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz'
environment:
YARN_VERSION: 1.16.0

- checkout
YARN_VERSION: << parameters.yarn >>

- restore_cache:
keys:
- v1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
- v1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-
- v1-dependencies-{{ .Environment.CIRCLE_JOB }}-
- v2.1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
- v2.1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-
- v2.1-dependencies-{{ .Environment.CIRCLE_JOB }}-

- run: yarn install
- run: yarn audit
- steps: << parameters.postinstall >>

- save_cache:
key: v1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
key: v2.1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
paths:
- node_modules
- ~/.cache/yarn

audit:
steps:
- checkout
- install:
postinstall:
- run: yarn audit

test:
steps:
- run: node --version

- checkout
- install

- run:
name: Prettier formatting
command: yarn check:format
Expand All @@ -47,10 +73,6 @@ references:
name: TSLint
command: yarn lint:ts

- run:
name: TypeScript type checking
command: yarn check:ts

- run:
name: Jest
command: yarn test:coverage --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
Expand All @@ -66,40 +88,43 @@ references:
path: ./coverage
destination: coverage

version: 2
jobs:
current:
<<: *base
audit:
executor: node
steps:
- audit

carbon:
<<: *base
docker:
- image: circleci/node:carbon
test-node8:
executor:
name: node
version: '8'
steps:
- test

erbium:
<<: *base
docker:
- image: circleci/node:12
test-node10:
executor:
name: node
version: '10.16.0' # Specify TLS version for development
steps:
- test

github-release:
<<: *base
test-node12:
executor:
name: node
version: '12'
steps:
- checkout
- run:
name: Create release on GitHub
command: curl https://raw.githubusercontent.com/marp-team/marp/master/github-release.js | node
- test

workflows:
version: 2
build:
test:
jobs:
- current
- carbon
- erbium
- github-release:
context: github-release
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- audit
- test-node8:
requires:
- audit
- test-node10:
requires:
- audit
- test-node12:
requires:
- audit
16 changes: 16 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: GitHub Release

on:
push:
tags:
- v*

jobs:
github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: marp-team/actions@v1
with:
task: release
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Changed

- Update CircleCI configuration to use v2.1 ([#101](https://github.com/marp-team/marp-core/pull/101))

## v0.12.1 - 2019-08-23

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"test": "jest",
"test:coverage": "jest --coverage",
"types": "rimraf types && tsc --declaration --emitDeclarationOnly --outDir types",
"version": "curl https://raw.githubusercontent.com/marp-team/marp/master/version.js | node && git add -A CHANGELOG.md",
"version": "curl https://raw.githubusercontent.com/marp-team/actions/v1/lib/scripts/version.js | node && git add -A CHANGELOG.md",
"watch": "rollup -w -c"
},
"devDependencies": {
Expand Down

0 comments on commit 11f2397

Please sign in to comment.