Add Circle CI config (#1)
This commit is contained in:
Родитель
13533ae5f8
Коммит
6d17f0c549
|
@ -0,0 +1,110 @@
|
|||
# These environment variables must be set in CircleCI UI
|
||||
#
|
||||
# NPM_TOKEN - A valid NPM token for releases
|
||||
version: 2.1
|
||||
|
||||
references:
|
||||
defaults: &defaults
|
||||
working_directory: ~/addons-moz-compare
|
||||
docker:
|
||||
# This is the NodeJS version we run in production.
|
||||
- image: circleci/node:12
|
||||
|
||||
defaults-next: &defaults-next
|
||||
working_directory: ~/addons-moz-compare
|
||||
docker:
|
||||
# This is the next NodeJS version we will support.
|
||||
- image: circleci/node:14
|
||||
|
||||
restore_build_cache: &restore_build_cache
|
||||
restore_cache:
|
||||
name: restore yarn package cache
|
||||
keys:
|
||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
||||
|
||||
run_yarn_install: &run_yarn_install
|
||||
run:
|
||||
name: install dependencies
|
||||
# See: https://github.com/mozilla/addons-frontend/issues/3034
|
||||
command: yarn install --pure-lockfile
|
||||
|
||||
save_build_cache: &save_build_cache
|
||||
save_cache:
|
||||
name: save yarn package cache
|
||||
key: yarn-packages-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/.cache/yarn
|
||||
|
||||
restore_next_build_cache: &restore_next_build_cache
|
||||
restore_cache:
|
||||
name: restore yarn package cache
|
||||
keys:
|
||||
- next-yarn-packages-{{ checksum "yarn.lock" }}
|
||||
|
||||
save_next_build_cache: &save_next_build_cache
|
||||
save_cache:
|
||||
name: save yarn package cache
|
||||
key: next-yarn-packages-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/.cache/yarn
|
||||
|
||||
jobs:
|
||||
test:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- *restore_build_cache
|
||||
- *run_yarn_install
|
||||
- *save_build_cache
|
||||
- run:
|
||||
name: unit tests
|
||||
command: yarn test-ci
|
||||
# Make sure we can build a production package.
|
||||
- run: yarn pack
|
||||
# Set up a workspace to share data between this job and the `release-tag`
|
||||
# one when we want to publish a new npm version.
|
||||
- persist_to_workspace:
|
||||
root: ~/addons-moz-compare
|
||||
paths: .
|
||||
- store_artifacts:
|
||||
path: coverage
|
||||
|
||||
test-next:
|
||||
<<: *defaults-next
|
||||
steps:
|
||||
- checkout
|
||||
- *restore_next_build_cache
|
||||
- *run_yarn_install
|
||||
- *save_next_build_cache
|
||||
- run: yarn test-ci
|
||||
|
||||
release-tag:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/addons-moz-compare
|
||||
- run:
|
||||
name: authenticate with registry
|
||||
# We don't want to expand the token in this file, npm will do it.
|
||||
command: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/addons-moz-compare/.npmrc
|
||||
- run:
|
||||
name: publish package
|
||||
command: npm publish
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
default-workflow:
|
||||
jobs:
|
||||
- test:
|
||||
filters: # required since `release-tag` has tag filters AND requires `test`
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-next
|
||||
- release-tag:
|
||||
requires:
|
||||
- test
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
ignore: /.*/
|
|
@ -1 +1,3 @@
|
|||
coverage/
|
||||
node_modules/
|
||||
*.tgz
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.*
|
||||
coverage/
|
||||
tests/
|
|
@ -0,0 +1,2 @@
|
|||
tag-version-prefix = ""
|
||||
message = ":arrow_up: release %s"
|
|
@ -6,7 +6,8 @@
|
|||
"author": "Mozilla Add-ons Team",
|
||||
"license": "MPL-2.0",
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
"test": "jest",
|
||||
"test-ci": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^26.6.3"
|
||||
|
|
Загрузка…
Ссылка в новой задаче