Skip to content

Commit

Permalink
Merge pull request #110 from Financial-Times/tool-kit-migration-two
Browse files Browse the repository at this point in the history
CP-1008: Tool kit migration
  • Loading branch information
jkerr321 authored Jan 19, 2023
2 parents d6e87fb + 510d33d commit 33c42e1
Show file tree
Hide file tree
Showing 9 changed files with 11,579 additions and 12,550 deletions.
263 changes: 46 additions & 217 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,223 +1,60 @@
# generator: n-circle2-cli
# template: component

references:

container_config_node:
&container_config_node
working_directory: ~/project/build
docker:
- image: cimg/node:<< parameters.node-version >>
parameters:
node-version:
default: "16.14"
type: string

workspace_root: &workspace_root ~/project

attach_workspace:
&attach_workspace
attach_workspace:
at: *workspace_root

npm_cache_keys:
&npm_cache_keys
keys:
- v10-dependency-npm-{{ checksum "package.json" }}-
- v10-dependency-npm-{{ checksum "package.json" }}
- v10-dependency-npm-

cache_npm_cache:
&cache_npm_cache
save_cache:
key: v10-dependency-npm-{{ checksum "package.json" }}-{{ epoch }}
paths:
- ./node_modules/

restore_npm_cache:
&restore_npm_cache
restore_cache:
<<: *npm_cache_keys

filters_only_main:
&filters_only_main
branches:
only: main

filters_ignore_tags:
&filters_ignore_tags
tags:
ignore: /.*/

filters_version_tag:
&filters_version_tag
tags:
only:
- /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
branches:
ignore: /.*/

filters_only_renovate_nori:
&filters_only_renovate_nori
branches:
only: /(^renovate-.*|^nori/.*)/

filters_ignore_tags_renovate_nori:
&filters_ignore_tags_renovate_nori
tags:
ignore: /.*/
branches:
ignore: /(^renovate-.*|^nori/.*)/

# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
version: 2.1

orbs:
node: circleci/node@4.6.0

tool-kit: financial-times/dotcom-tool-kit@2
jobs:

build:
<<: *container_config_node
checkout:
docker:
- image: cimg/base:stable
steps:
- checkout
- run:
name: Checkout next-ci-shared-helpers
command: git clone --depth 1
git@github.com:Financial-Times/next-ci-shared-helpers.git
.circleci/shared-helpers
- *restore_npm_cache
- node/install-npm:
version: "7.20.2"
- run:
name: Install project dependencies
command: make install
- run:
name: Run the project build task
command: make build
- run:
name: shared-helper / generate-build-state-artifacts
command: .circleci/shared-helpers/helper-generate-build-state-artifacts
when: always
- *cache_npm_cache
- store_artifacts:
path: build-state
destination: build-state
- persist_to_workspace:
root: *workspace_root
paths:
- build

test:
<<: *container_config_node
steps:
- *attach_workspace
- run:
name: Run tests
command: make test
environment:
JEST_JUNIT_OUTPUT: test-results/jest/results.xml
MOCHA_FILE: test-results/mocha/results.xml
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
destination: test-results

publish:
<<: *container_config_node
steps:
- *attach_workspace
- run:
name: shared-helper / npm-store-auth-token
command: .circleci/shared-helpers/helper-npm-store-auth-token
- run: npx snyk monitor --org=customer-products
--project-name=Financial-Times/ft-poller
- run:
name: shared-helper / npm-version-and-publish-public
command: .circleci/shared-helpers/helper-npm-version-and-publish-public

- tool-kit/persist-workspace:
path: .
workflows:

version: 2

build-test:
when:
not:
equal:
- scheduled_pipeline
- << pipeline.trigger_source >>
jobs:
- build:
filters:
<<: *filters_ignore_tags_renovate_nori
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
- test:
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]

build-test-publish:
tool-kit:
when:
not:
equal:
- scheduled_pipeline
- << pipeline.trigger_source >>
jobs:
- build:
- checkout:
filters:
<<: *filters_version_tag
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
- test:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- waiting-for-approval:
type: approval
filters:
<<: *filters_version_tag
branches:
only: /(^renovate-.*|^nori/.*)/
- tool-kit/setup:
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
- publish:
context: npm-publish-token
- checkout
- waiting-for-approval
filters:
<<: *filters_version_tag
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/build:
requires:
- test-v16.14

renovate-nori-build-test:
when:
not:
equal:
- scheduled_pipeline
- << pipeline.trigger_source >>
jobs:
- waiting-for-approval:
type: approval
- tool-kit/setup
filters:
<<: *filters_only_renovate_nori
- build:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/test:
requires:
- waiting-for-approval
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
- test:
- tool-kit/build
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
- tool-kit/publish:
context: npm-publish-token
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]

- tool-kit/test
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+(-.+)?/
nightly:
when:
and:
Expand All @@ -228,21 +65,13 @@ workflows:
- nightly
- << pipeline.schedule.name >>
jobs:
- build:
context: next-nightly-build
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
- test:
- checkout
- tool-kit/setup:
requires:
- checkout
- tool-kit/build:
requires:
- tool-kit/setup
- tool-kit/test:
requires:
- build-v<< matrix.node-version >>
context: next-nightly-build
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]

notify:
webhooks:
- url: https://ft-next-webhooks.herokuapp.com/circleci2-workflow
- tool-kit/build
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@financial-times/eslint-config-next']
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
.editorconfig
.eslintrc.js

*.env*
12 changes: 12 additions & 0 deletions .toolkitrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins:
- '@dotcom-tool-kit/component'
- '@dotcom-tool-kit/mocha'
- '@dotcom-tool-kit/eslint'
hooks:
test:local:
- Eslint
- Mocha
test:ci:
- Eslint
- Mocha

10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

Loading

0 comments on commit 33c42e1

Please sign in to comment.