Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: transition to circle 2 and cache test fixtures in CI #634

Merged
merged 6 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
# Constant values.

node_modules_cache_key: &node_modules_cache_key node-modules-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
test_fixtures_cache_key: &test_fixtures_cache_key test-fixtures-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "test/fixtures/plugin-fixtures.json" }}
test_env: &test_env
GCLOUD_PROJECT: 0
GCLOUD_TRACE_NEW_CONTEXT: 1

# Unit test workflow.

unit_tests: &unit_tests
steps:
- checkout
- run:
name: Configure npm to allow running scripts as root
command: npm config set unsafe-perm true
- restore_cache:
key: *node_modules_cache_key
- run:
name: Install modules and dependencies
command: npm install
- save_cache:
key: *node_modules_cache_key
paths:
- node_modules
- run:
name: Check code style and linting
command: npm run check
- run:
name: Compile code
command: npm run compile
- restore_cache:
key: *test_fixtures_cache_key
- run:
name: Install test fixtures
command: npm run init-test-fixtures
- save_cache:
key: *test_fixtures_cache_key
paths:
- build/test/plugins/fixtures
- run:
name: Run unit tests with code coverage
command: npm run coverage
- run:
name: Verify that the package installs OK
command: npm run check-install
- run:
name: Run system tests (skipped for PRs)
command: npm run system-test

# Services needed for unit tests.

mongo_service: &mongo_service
image: mongo

redis_service: &redis_service
image: redis

postgres_service: &postgres_service
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Password12!
POSTGRES_DB: test

mysql_service: &mysql_service
image: mysql
environment:
MYSQL_ROOT_PASSWORD: Password12!
MYSQL_DATABASE: test

# Main configuration.

version: 2.0
workflows:
version: 2
tests:
jobs:
- node4
- node6
- node8
- node9

jobs:
node4:
docker:
- image: node:4
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
- *mysql_service
<<: *unit_tests
node6:
docker:
- image: node:6
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
- *mysql_service
<<: *unit_tests
node8:
docker:
- image: node:8
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
- *mysql_service
<<: *unit_tests
node9:
docker:
- image: node:9
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
- *mysql_service
<<: *unit_tests
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

14 changes: 12 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ environment:
- nodejs_version: "6"
- nodejs_version: "8"

cache:
- node_modules -> package-lock.json, package.json
- build\test\plugins\fixtures -> test\fixtures\plugin-fixtures.json

services:
- mongodb
- mysql
Expand All @@ -19,8 +23,6 @@ install:
- nuget install redis-64 -excludeversion
- redis-64\tools\redis-server.exe --service-install
- redis-64\tools\redis-server.exe --service-start
# install modules
- npm install
- SET GCLOUD_PROJECT=0
- SET GCLOUD_TRACE_NEW_CONTEXT=1

Expand All @@ -34,8 +36,16 @@ before_test:

# Post-install test scripts.
test_script:
# install modules
- npm install
# check code style and linting
- npm run check
# compile the code
- npm run compile
# check that installing this module is OK
- npm run check-install
# initialize test fixtures
- npm run init-test-fixtures
# run tests
- npm run test

Expand Down
8 changes: 0 additions & 8 deletions circle.yml

This file was deleted.

Binary file removed node-team-test-d0b0be11c23d.json.enc
Binary file not shown.
Binary file added node-team-test-de480e4f9023.json.enc
Binary file not shown.
Loading