fxa/.circleci/config.yml

453 строки
12 KiB
YAML

version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.2.3
executors:
content-server-executor:
resource_class: medium+
docker:
- image: cimg/node:14.18-browsers
- image: redis
- image: memcached
- image: pafortin/goaws
- image: circleci/mysql:5.7.27
- image: jdlk7/firestore-emulator
environment:
NODE_ENV: dev
FXA_EMAIL_ENV: dev
FXA_EMAIL_LOG_LEVEL: debug
RUST_BACKTRACE: 1
AUTH_FIRESTORE_EMULATOR_HOST: localhost:9090
environment:
FXA_MX_RECORD_EXCLUSIONS: restmail.dev.lcip.org
commands:
base-install:
parameters:
package:
type: string
default: none
steps:
- checkout
- restore_cache:
keys:
# prefer the exact hash
- fxa-yarn-cache-3-{{ checksum "yarn.lock" }}
# any cache to start with is better than nothing
- fxa-yarn-cache-3-
- run: ./.circleci/base-install.sh << parameters.package >>
- save_cache:
key: fxa-yarn-cache-3-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- .yarn/build-state.yml
- .yarn/install-state.gz
test-content-server-part:
parameters:
index:
type: integer
default: 0
total:
type: integer
default: 6
steps:
- browser-tools/install-firefox:
version: 78.9.0esr
- browser-tools/install-geckodriver:
version: v0.29.1
- base-install:
package: fxa-content-server
- run:
name: Running test section << parameters.index >> of << parameters.total >>
environment:
CIRCLE_NODE_INDEX: << parameters.index >>
CIRCLE_NODE_TOTAL: << parameters.total >>
command: ./.circleci/test-package.sh fxa-content-server
- store_artifacts:
path: ~/.pm2/logs
destination: logs
- store_artifacts:
path: ~/screenshots
destination: screenshots
- store_test_results:
path: artifacts/tests
test-settings-server:
steps:
- browser-tools/install-firefox:
version: 78.9.0esr
- browser-tools/install-geckodriver:
version: v0.29.1
- base-install:
package: fxa-settings
- run:
name: Running test...
command: ./.circleci/test-package.sh fxa-settings
- store_artifacts:
path: ~/.pm2/logs
destination: logs
- store_artifacts:
path: ~/screenshots
destination: screenshots
- store_test_results:
path: artifacts/tests
jobs:
test-package:
resource_class: medium+
docker:
- image: cimg/node:14.18
- image: redis
- image: memcached
- image: pafortin/goaws
- image: circleci/mysql:5.7.27
- image: jdlk7/firestore-emulator
environment:
NODE_ENV: dev
AUTH_FIRESTORE_EMULATOR_HOST: localhost:9090
parameters:
package:
type: string
steps:
- base-install:
package: << parameters.package >>
- run:
name: Testing << parameters.package >>
command: ./.circleci/test-package.sh << parameters.package >>
- store_test_results:
path: artifacts/tests
- run:
name: Reporting code coverage...
command: bash <(curl -s https://codecov.io/bash) -F << parameters.package >> -X gcov
test-many:
resource_class: medium+
docker:
- image: cimg/node:14.18
- image: circleci/mysql:5.7.27
- image: jdlk7/firestore-emulator
- image: memcached
- image: redis
steps:
- base-install:
package: many
- run:
name: Testing...
command: |
PACKAGES=(\
'fxa-shared' \
'fxa-react' \
'fxa-admin-server' \
'fxa-graphql-api' \
'fxa-admin-panel' \
'fxa-payments-server' \
'fxa-support-panel' \
'fxa-event-broker' \
'fxa-auth-db-mysql' \
'fxa-profile-server' \
'123done' \
'browserid-verifier' \
'fortress' \
'fxa-auth-client' \
'fxa-geodb' \
'fxa-email-event-proxy' \
'fxa-customs-server' \
)
for p in "${PACKAGES[@]}"; do
./.circleci/test-package.sh $p
done
- run:
name: Reporting code coverage...
command: bash <(curl -s https://codecov.io/bash) -F many -X gcov
test-settings-server:
executor: content-server-executor
steps:
- test-settings-server
test-content-server-0:
executor: content-server-executor
steps:
- test-content-server-part:
index: 0
test-content-server-1:
executor: content-server-executor
steps:
- test-content-server-part:
index: 1
test-content-server-2:
executor: content-server-executor
steps:
- test-content-server-part:
index: 2
test-content-server-3:
executor: content-server-executor
steps:
- test-content-server-part:
index: 3
test-content-server-4:
executor: content-server-executor
steps:
- test-content-server-part:
index: 4
test-content-server-5:
executor: content-server-executor
steps:
- test-content-server-part:
index: 5
test-email-service:
resource_class: large
docker:
- image: circleci/rust:latest-node
- image: mysql:5.7.27
environment:
- MYSQL_DATABASE: fxa
- MYSQL_ALLOW_EMPTY_PASSWORD: yes
- MYSQL_ROOT_PASSWORD: ''
- image: redis
steps:
- base-install:
package: fxa-email-service
- run: cargo install cargo-audit
- run: ./packages/fxa-email-service/scripts/test-ci.sh
- store_artifacts:
path: artifacts
deploy-packages:
resource_class: small
docker:
- image: cimg/node:14.18
environment:
DOCKER_BUILDKIT: 1
steps:
- base-install
- setup_remote_docker:
version: 18.09.3
- run:
name: Build docker images
command: ./.circleci/build-all.sh
no_output_timeout: 1h
- run:
name: Push to docker hub
command: ./.circleci/deploy-all.sh
- store_artifacts:
path: artifacts
# This job is manually triggered for now. see .circleci/README.md
test-content-server-remote:
resource_class: large
docker:
# using the old image until we know why the orb is broken with manual jobs
- image: mozilla/fxa-circleci
steps:
- base-install:
package: fxa-content-server
- run:
name: Running test section against a remote target
command: ./packages/fxa-content-server/scripts/test-ci-remote.sh
- store_artifacts:
path: ~/screenshots
destination: screenshots
- store_test_results:
path: artifacts/tests
playwright-functional-tests:
resource_class: medium
docker:
- image: mcr.microsoft.com/playwright:focal
- image: redis
- image: memcached
- image: circleci/mysql:5.7.27
environment:
NODE_ENV: development
steps:
- base-install:
package: fxa-settings
- run:
name: Running playwright tests
command: ./packages/fxa-settings/scripts/playwright-tests.sh
- store_artifacts:
path: artifacts
- store_test_results:
path: artifacts/tests
build-and-deploy-storybooks:
resource_class: small
docker:
- image: cimg/node:14.18
steps:
- base-install:
package: many
- run:
name: Build and deploy Storybooks
command: npx github:mozilla-fxa/storybook-gcp-publisher
workflows:
test_pull_request:
jobs:
- test-many:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-settings-server:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-package:
name: test-auth-server
package: fxa-auth-server
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-0:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-1:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-2:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-3:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-4:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-content-server-5:
filters:
branches:
ignore: main
tags:
ignore: /.*/
- test-email-service:
# since email-service is expensive
# to build and rarely changes
# we only run it on branches
# starting with "email-service-"
filters:
branches:
only:
- /^email-service-.*/
tags:
ignore: /.*/
- build-and-deploy-storybooks:
filters:
branches:
ignore: main
tags:
ignore: /.*/
deploy_branch:
jobs:
- deploy-packages:
filters:
branches:
only:
- main
- /^feature.*/
- /^dockerpush.*/
tags:
ignore: /.*/
- build-and-deploy-storybooks:
filters:
branches:
only: main
tags:
ignore: /.*/
test_and_deploy_tag:
jobs:
- test-many:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-package:
name: test-auth-server
package: fxa-auth-server
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-0:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-1:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-2:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-3:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-4:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- test-content-server-5:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- deploy-packages:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
requires:
- test-many
- test-auth-server
- test-content-server-0
- test-content-server-1
- test-content-server-2
- test-content-server-3
- test-content-server-4
- test-content-server-5