addons-linter/.circleci/config.yml

181 строка
5.2 KiB
YAML
Исходник Обычный вид История

2020-12-15 21:58:40 +03:00
# These environment variables must be set in CircleCI UI
#
# NPM_TOKEN - A valid NPM token for releases
version: 2.1
orbs:
codecov: codecov/codecov@3.2.4
2020-12-15 21:58:40 +03:00
references:
defaults: &defaults
working_directory: ~/addons-linter
docker:
# This is the NodeJS version we run in production.
2023-03-21 12:13:19 +03:00
- image: cimg/node:16.19
2020-12-15 21:58:40 +03:00
defaults-next: &defaults-next
<<: *defaults
2020-12-15 21:58:40 +03:00
docker:
# This is the next NodeJS version we will support.
2023-03-21 12:13:19 +03:00
- image: cimg/node:18.15
2020-12-15 21:58:40 +03:00
defaults-alternate: &defaults-alternate
<<: *defaults
docker:
# This is an alternate Node version we support or want to support in the
# (far) future. It can either be lower or higher than the current Node
# version we run in production.
2023-02-16 23:45:35 +03:00
- image: cimg/node:19.6
2020-12-15 21:58:40 +03:00
restore_build_cache: &restore_build_cache
restore_cache:
name: restore npm package cache
keys:
- npm-packages-{{ checksum "package-lock.json" }}
run_npm_install: &run_npm_install
run:
name: install dependencies
command: npm install
save_build_cache: &save_build_cache
save_cache:
name: save npm package cache
key: npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
make_production_build: &make_production_build
run:
name: build project
command: |
node scripts/build-locales
NODE_ENV=production npm run build
restore_next_build_cache: &restore_next_build_cache
restore_cache:
name: restore npm package cache
keys:
- next-npm-packages-{{ checksum "package-lock.json" }}
save_next_build_cache: &save_next_build_cache
save_cache:
name: save npm package cache
key: next-npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
restore_alternate_build_cache: &restore_alternate_build_cache
restore_cache:
name: restore npm package cache
keys:
- alternate-npm-packages-{{ checksum "package-lock.json" }}
save_alternate_build_cache: &save_alternate_build_cache
save_cache:
name: save npm package cache
key: alternate-npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
2020-12-15 21:58:40 +03:00
jobs:
test:
<<: *defaults
steps:
- checkout
- *restore_build_cache
- *run_npm_install
- *save_build_cache
- *make_production_build
- run: npm run test-ci
- codecov/upload
2020-12-15 21:58:40 +03:00
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run lint
- run: npm run prettier-ci
2021-08-03 16:09:00 +03:00
- run:
name: build rules
command: |
npm run build-rules
# This will return a non-zero exit code if content in the docs/
# folder has changed. When this fails, run the following command
# and commit the changes:
#
# npm run build-rules
#
git diff --name-only --exit-code docs
2020-12-15 21:58:40 +03:00
# 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-linter
paths: .
2021-06-11 15:11:47 +03:00
# This should run after we persist the workspace because this command
# invokes `npm install`.
- run: npm run webext-test-functional
- run: npm run smoke-test-eslint-version-conflicts
2020-12-15 21:58:40 +03:00
- store_artifacts:
path: coverage
test-next:
<<: *defaults-next
steps:
- checkout
- *restore_next_build_cache
- *run_npm_install
- *save_next_build_cache
- *make_production_build
- run: npm run test-ci
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run webext-test-functional
- run: npm run smoke-test-eslint-version-conflicts
2020-12-15 21:58:40 +03:00
test-alternate:
<<: *defaults-alternate
steps:
- checkout
- *restore_alternate_build_cache
- *run_npm_install
- *save_alternate_build_cache
- *make_production_build
- run: npm run test-ci
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run webext-test-functional
- run: npm run smoke-test-eslint-version-conflicts
2020-12-15 21:58:40 +03:00
release-tag:
<<: *defaults
steps:
- attach_workspace:
at: ~/addons-linter
- run:
name: authenticate with registry
2020-12-18 16:07:40 +03:00
# We don't want to expand the token in this file, npm will do it.
2020-12-18 17:48:05 +03:00
command: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/addons-linter/.npmrc
2020-12-15 21:58:40 +03:00
- 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
- test-alternate
2020-12-15 21:58:40 +03:00
- release-tag:
requires:
- test
filters:
tags:
only: /.*/
branches:
ignore: /.*/