From 5b00ffaf42d1d0595ec68ebae96b2e2496c2d39e Mon Sep 17 00:00:00 2001 From: Ryan Ling Date: Wed, 14 Jul 2021 07:34:33 +1000 Subject: [PATCH] Add test:ci script to rest of templates (#473) --- .changeset/afraid-humans-design.md | 5 ----- .changeset/calm-seahorses-stare.md | 5 +++++ .changeset/quiet-actors-live.md | 5 ----- template/greeter/.buildkite/pipeline.yml | 6 ++--- template/greeter/package.json | 3 ++- .../.buildkite/pipeline.yml | 22 +++++++++---------- template/lambda-sqs-worker-cdk/package.json | 2 ++ .../lambda-sqs-worker/.buildkite/pipeline.yml | 4 ++-- template/lambda-sqs-worker/package.json | 3 ++- .../.github/workflows/validate.yml | 6 ++--- template/oss-npm-package/_package.json | 3 ++- template/private-npm-package/_package.json | 1 + 12 files changed, 33 insertions(+), 32 deletions(-) delete mode 100644 .changeset/afraid-humans-design.md create mode 100644 .changeset/calm-seahorses-stare.md delete mode 100644 .changeset/quiet-actors-live.md diff --git a/.changeset/afraid-humans-design.md b/.changeset/afraid-humans-design.md deleted file mode 100644 index 668addbdb..000000000 --- a/.changeset/afraid-humans-design.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'skuba': patch ---- - -**template/express-rest-api:** Add `test:ci` script diff --git a/.changeset/calm-seahorses-stare.md b/.changeset/calm-seahorses-stare.md new file mode 100644 index 000000000..63a0efb29 --- /dev/null +++ b/.changeset/calm-seahorses-stare.md @@ -0,0 +1,5 @@ +--- +'skuba': patch +--- + +**template:** Add `test:ci` script diff --git a/.changeset/quiet-actors-live.md b/.changeset/quiet-actors-live.md deleted file mode 100644 index 85459effa..000000000 --- a/.changeset/quiet-actors-live.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'skuba': patch ---- - -**template/koa-rest-api:** Add `test:ci` script diff --git a/template/greeter/.buildkite/pipeline.yml b/template/greeter/.buildkite/pipeline.yml index e420c3eed..6ec90b9fd 100644 --- a/template/greeter/.buildkite/pipeline.yml +++ b/template/greeter/.buildkite/pipeline.yml @@ -21,9 +21,9 @@ steps: - <<: *prod label: 🧪 Test & Lint commands: - - echo '+++ yarn test' - - yarn test - - echo '+++ yarn lint' + - echo '+++ yarn test:ci' + - yarn test:ci + - echo '--- yarn lint' - yarn lint plugins: - *aws-sm diff --git a/template/greeter/package.json b/template/greeter/package.json index 4d3736a93..f219058ec 100644 --- a/template/greeter/package.json +++ b/template/greeter/package.json @@ -20,7 +20,8 @@ "lint": "skuba lint", "start": "ENVIRONMENT=local skuba start", "start:debug": "yarn start --inspect-brk", - "test": "skuba test --coverage", + "test": "skuba test", + "test:ci": "skuba test --coverage", "test:watch": "skuba test --watch" } } diff --git a/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml b/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml index bc4da0fa3..e32076171 100644 --- a/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +++ b/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml @@ -6,10 +6,10 @@ prod-agent: &prod-agent agents: queue: <%- prodBuildkiteQueueName %> -plugins: &plugins #alias for shared plugins +plugins: &plugins seek-oss/aws-sm#v2.3.1: env: - NPM_READ_TOKEN: 'arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token' + NPM_READ_TOKEN: arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token docker#v3.8.0: volumes: - /workdir/node_modules @@ -24,24 +24,24 @@ plugins: &plugins #alias for shared plugins - yarn.lock steps: - - label: ':yarn: :eslint: Lint and :jest: unit test' + - label: ':yarn: :eslint: Lint and :jest: unit test' <<: *dev-agent plugins: <<: *plugins key: test - command: - - echo "--- Running yarn lint" - - yarn lint - - echo "--- Running yarn test :jest:" + commands: + - echo "+++ yarn test:ci" - yarn test + - echo "--- yarn lint" + - yarn lint - - label: 'Build & CDK Deploy Staging :shipit:' + - label: 'Build & CDK Deploy Staging :shipit:' <<: *dev-agent plugins: <<: *plugins depends_on: - test - command: + commands: - echo "--- Building code" - yarn build - echo "--- Running CDK deploy to staging" @@ -49,14 +49,14 @@ steps: concurrency: 1 concurrency_group: '<%- repoName %>/deploy/dev' - - label: 'Build & CDK Deploy Production :shipit:' + - label: 'Build & CDK Deploy Production :shipit:' branches: 'master' <<: *prod-agent plugins: <<: *plugins depends_on: - test - command: + commands: - echo "--- Building code" - yarn build - echo "--- Running CDK deploy to production" diff --git a/template/lambda-sqs-worker-cdk/package.json b/template/lambda-sqs-worker-cdk/package.json index d082b69f8..2eeb7fd1e 100644 --- a/template/lambda-sqs-worker-cdk/package.json +++ b/template/lambda-sqs-worker-cdk/package.json @@ -28,6 +28,8 @@ "format": "skuba format", "lint": "skuba lint", "test": "skuba test", + "test:ci": "skuba test --coverage", + "test:watch": "skuba test --watch", "package": "yarn --prod --modules-folder ./lib/node_modules", "deploy:dev": "cdk deploy appStack --require-approval never --context stage=dev", "deploy:prod": "cdk deploy appStack --require-approval never --context stage=prod" diff --git a/template/lambda-sqs-worker/.buildkite/pipeline.yml b/template/lambda-sqs-worker/.buildkite/pipeline.yml index 317d0f02e..183a9ea7f 100644 --- a/template/lambda-sqs-worker/.buildkite/pipeline.yml +++ b/template/lambda-sqs-worker/.buildkite/pipeline.yml @@ -46,8 +46,8 @@ steps: - <<: *prod label: 🧪 Test & Lint commands: - - echo '+++ yarn test' - - yarn test + - echo '+++ yarn test:ci' + - yarn test:ci - echo '+++ yarn lint' - yarn lint plugins: diff --git a/template/lambda-sqs-worker/package.json b/template/lambda-sqs-worker/package.json index 5fecc3dd6..de38ae836 100644 --- a/template/lambda-sqs-worker/package.json +++ b/template/lambda-sqs-worker/package.json @@ -34,7 +34,8 @@ "smoke": "serverless invoke --data '{}' --function Worker", "start": "ENVIRONMENT=local skuba start --port <%- port %>", "start:debug": "yarn start --inspect-brk", - "test": "skuba test --coverage", + "test": "skuba test", + "test:ci": "skuba test --coverage", "test:watch": "skuba test --watch" } } diff --git a/template/oss-npm-package/.github/workflows/validate.yml b/template/oss-npm-package/.github/workflows/validate.yml index 8888cedcf..f5dacbac3 100644 --- a/template/oss-npm-package/.github/workflows/validate.yml +++ b/template/oss-npm-package/.github/workflows/validate.yml @@ -24,8 +24,8 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + - name: Test + run: yarn test:ci + - name: Lint run: yarn lint - - - name: Test - run: yarn test diff --git a/template/oss-npm-package/_package.json b/template/oss-npm-package/_package.json index b422f780b..71e98b5ae 100644 --- a/template/oss-npm-package/_package.json +++ b/template/oss-npm-package/_package.json @@ -29,7 +29,8 @@ "format": "skuba format", "lint": "skuba lint", "release": "yarn build && skuba release", - "test": "skuba test --coverage", + "test": "skuba test", + "test:ci": "skuba test --coverage", "test:watch": "skuba test --watch" }, "config": { diff --git a/template/private-npm-package/_package.json b/template/private-npm-package/_package.json index 88262ef0a..c64cb59ca 100644 --- a/template/private-npm-package/_package.json +++ b/template/private-npm-package/_package.json @@ -30,6 +30,7 @@ "lint": "skuba lint", "release": "yarn build && skuba release", "test": "skuba test --coverage", + "test:ci": "yarn -s test", "test:watch": "skuba test --watch" }, "config": {