fxa/.circleci/config.yml

537 строки
14 KiB
YAML

version: 2.1
executors:
nodejs:
docker:
- image: circleci/node:10
commands:
npm-install:
parameters:
module:
type: string
default: "dependencies"
steps:
- restore_cache:
keys:
- v2-<< parameters.module >>-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v2-<< parameters.module >>-
- run: npm ci
- save_cache:
paths:
- node_modules
key: v2-<< parameters.module >>-{{ checksum "package.json" }}
jobs:
install:
executor: nodejs
steps:
- checkout
- npm-install
- run:
name: Create version.json
command: >
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n'
"$CIRCLE_SHA1"
"$CIRCLE_TAG"
"$CIRCLE_PROJECT_USERNAME"
"$CIRCLE_PROJECT_REPONAME"
"$CIRCLE_BUILD_URL"
| tee packages/version.json
- run: node .circleci/modules-to-test.js | tee packages/test.list
- store_artifacts:
path: packages/version.json
- persist_to_workspace:
root: ~/.
paths:
- project/*
build-module:
executor: nodejs
parameters:
module:
type: string
test:
type: string
default: test
db:
type: boolean
default: false
working_directory: ~/project/packages/<< parameters.module >>
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- when:
condition: << parameters.db >>
steps:
- run:
name: Start mysql
command: docker pull mysql/mysql-server:5.6 && docker run -d --name=mydb -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:5.6
- run:
name: Start memcached
command: docker pull memcached && docker run -d --name memcached -p 11211:11211 memcached
- run:
name: Start redis
command: docker pull redis && docker run -d --name redis-server -p 6379:6379 redis
- run:
name: Start gcloud firestore
command: docker pull jdlk7/firestore-emulator && docker run -d --name gcloud-firestore -p 8006:9090 jdlk7/firestore-emulator
- run: ../../.circleci/build-test-deploy.sh << parameters.test >>
deploy-module:
executor: nodejs
parameters:
module:
type: string
working_directory: ~/project/packages/<< parameters.module >>
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- run: ../../.circleci/build.sh << parameters.module >>
- run: ../../.circleci/deploy.sh << parameters.module >>
fxa-oauth-server:
executor: nodejs
working_directory: ~/project/packages/fxa-auth-server
steps:
- attach_workspace:
at: ~/.
- setup_remote_docker
- run:
name: Start mysql
command: docker pull mysql/mysql-server:5.6 && docker run -d --name=mydb -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:5.6
- run: ../../.circleci/build.sh fxa-oauth-server
- run: ../../.circleci/test.sh fxa-oauth-server
- run: ../../.circleci/deploy.sh fxa-oauth-server
install-content-server:
resource_class: xlarge
executor: nodejs
working_directory: ~/project/packages/fxa-content-server
steps:
- attach_workspace:
at: ~/.
- run: ../../.circleci/install-content-server.sh
- persist_to_workspace:
root: ~/.
paths:
- project/*
test-content-server:
parallelism: 6
docker:
- image: circleci/node:10-stretch-browsers
- image: redis
- image: memcached
- image: pafortin/goaws
working_directory: ~/project/packages/fxa-content-server
steps:
- attach_workspace:
at: ~/
- run: ../../.circleci/test-content-server.sh
# run pairing tests on one node
- deploy:
command: ../../.circleci/test-content-server.sh pairing
- setup_remote_docker
- deploy:
command: ../../_scripts/install_docker.sh
- deploy:
command: ../../.circleci/build.sh fxa-content-server
- deploy:
command: ../../.circleci/deploy.sh fxa-content-server
- store_artifacts:
path: ~/.pm2/logs
destination: logs
fxa-shared:
docker:
- image: circleci/node:10
- image: redis
working_directory: ~/project/packages/fxa-shared
steps:
- attach_workspace:
at: ~/
- npm-install:
module: fxa-shared
- run: rm ~/project/package.json
- run: npm run lint
- run: npm test
js-client:
docker:
- image: circleci/node:8
working_directory: ~/project/packages/fxa-js-client
steps:
- attach_workspace:
at: ~/
- run: ../../.circleci/test-js-client.sh
fxa-email-event-proxy:
docker:
- image: circleci/node:8
working_directory: ~/project/packages/fxa-email-event-proxy
steps:
- attach_workspace:
at: ~/
- run: npm ci
- run: npm run lint
- run: npm t
fxa-email-event-proxy-tag:
docker:
- image: circleci/node:8
working_directory: ~/project/packages/fxa-email-event-proxy
steps:
- attach_workspace:
at: ~/
- run: npm ci
- run: |
if [ -n "${CIRCLE_TAG}" ]; then
exit 0
fi
npm run build
mkdir artifacts
mv fxa-email-event-proxy.zip "artifacts/fxa-email-event-proxy.$CIRCLE_TAG.zip"
- store_artifacts:
path: artifacts
fxa-email-service:
resource_class: xlarge
docker:
- image: circleci/node:10
- image: mysql:5.6
environment:
- MYSQL_DATABASE: fxa
- MYSQL_ALLOW_EMPTY_PASSWORD: yes
- MYSQL_ROOT_PASSWORD: ""
- image: redis
working_directory: ~/project/packages/fxa-email-service
steps:
- attach_workspace:
at: ~/
- run: |
. ../../.circleci/install-rust.sh
rustup component add rustfmt-preview
cargo fmt -- --check
./scripts/test_with_authdb.sh
cargo install cargo-audit
# --ignore ref: https://github.com/crossbeam-rs/crossbeam/issues/401
# hyper/reqwest/tokio -> tokio-threadpool -> crossbeam-deque -> crossbeam-epoch -> memoffset
cargo audit --ignore RUSTSEC-2019-0011
mkdir -m 755 bin
mkdir -m 755 bin/config
cargo build --release
cp config/* bin/config
cp target/release/fxa_email_send bin
cp target/release/fxa_email_queues bin
cargo clean
- store_artifacts:
path: fxa-auth-db-mysql.log
- setup_remote_docker
- run: |
../../.circleci/tag.sh fxa-email-service
fxa-email-service-tag:
resource_class: xlarge
docker:
- image: circleci/node:10
working_directory: ~/project/packages/fxa-email-service
steps:
- attach_workspace:
at: ~/
- run: |
. ../../.circleci/install-rust.sh
cargo --version
rustc --version
mkdir -m 755 bin
mkdir -m 755 bin/config
cargo build --release
cp config/* bin/config
cp target/release/fxa_email_send bin
cp target/release/fxa_email_queues bin
cargo clean
- setup_remote_docker
- run: |
../../.circleci/tag.sh fxa-email-service
docs:
docker:
- image: circleci/node:10
working_directory: ~/project
steps:
- attach_workspace:
at: ~/
- add_ssh_keys:
fingerprints:
- "08:fc:2b:fb:06:0e:8f:0f:01:1f:28:86:83:89:11:28"
- run: |
# Docs won't build on forks or the private repo because they don't have the deploy key.
if [ "$CIRCLE_PR_REPONAME" = "" ] && [ "$CIRCLE_REPOSITORY_URL" = "git@github.com:mozilla/fxa.git" ]; then
ssh-keyscan github.com >> ~/.ssh/known_hosts
. .circleci/install-rust.sh
./_scripts/gh-pages.sh
fi
workflows:
test:
jobs:
- install
- build-module:
name: 123done
module: 123done
requires:
- install
- build-module:
name: browserid-verifier
module: browserid-verifier
requires:
- install
- build-module:
name: fxa-auth-db-mysql
module: fxa-auth-db-mysql
db: true
requires:
- install
- build-module:
name: fxa-auth-server
module: fxa-auth-server
db: true
test: test-ci
requires:
- install
- build-module:
name: fxa-basket-proxy
module: fxa-basket-proxy
requires:
- install
- build-module:
name: fxa-customs-server
module: fxa-customs-server
db: true
requires:
- install
- build-module:
name: fxa-event-broker
module: fxa-event-broker
db: true
requires:
- install
- build-module:
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- build-module:
name: fxa-payments-server
module: fxa-payments-server
requires:
- install
- build-module:
name: fxa-profile-server
module: fxa-profile-server
requires:
- install
- build-module:
name: fxa-support-panel
module: fxa-support-panel
requires:
- install
- install-content-server:
requires:
- install
- test-content-server:
requires:
- install-content-server
- fxa-shared:
requires:
- install
- js-client:
requires:
- install
- fxa-oauth-server:
requires:
- install
- fxa-email-event-proxy:
requires:
- install
- fxa-email-service:
requires:
- install
- docs:
requires:
- js-client
- fxa-email-service
deploy-tag:
jobs:
- install:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: 123done
module: 123done
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: browserid-verifier
module: browserid-verifier
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-auth-db-mysql
module: fxa-auth-db-mysql
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-auth-server
module: fxa-auth-server
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-basket-proxy
module: fxa-basket-proxy
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-customs-server
module: fxa-customs-server
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-event-broker
module: fxa-event-broker
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-oauth-console
module: fxa-oauth-console
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-payments-server
module: fxa-payments-server
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-profile-server
module: fxa-profile-server
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-support-panel
module: fxa-support-panel
requires:
- install
- deploy-module:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
name: fxa-content-server
module: fxa-content-server
requires:
- install
- fxa-email-event-proxy-tag:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
requires:
- install
- fxa-oauth-server:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
requires:
- install
- fxa-email-service-tag:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
requires:
- install