1
0
mirror of https://github.com/nostalgic-css/NES.css.git synced 2025-08-31 17:51:46 +02:00
Files
nes.css/.circleci/config.yml

272 lines
6.0 KiB
YAML

orbs:
node: circleci/node@4.0.1
version: 2.1
defaults: &defaults
working_directory: ~/app
supported-node-versions: &supported-node-versions
node-version: ["10.22.1", "12.18.4", "14.13.0"]
jobs:
commitlint:
docker:
- image: secretbase/circleci-commitlint:1.0.2
working_directory: ~/app
environment:
CIRCLE_COMPARE_URL: << pipeline.project.git_url >>/compare/<< pipeline.git.base_revision >>..<<pipeline.git.revision>>
steps:
- checkout
- run:
name: Lint commit messages
command: /bin/sh /.scripts/commitlint_range.sh
checkout:
<<: *defaults
docker:
- image: cimg/node:lts
steps:
- restore_cache:
name: Restore Repository Cache
keys:
- repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- repo-{{ .Branch }}
- repo-master
- repo-
- checkout
- save_cache:
name: Save Repository Cache
key: repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- .
- persist_to_workspace:
root: .
paths:
- .
install-dependencies:
<<: *defaults
parameters:
node-version:
type: string
docker:
- image: "cimg/node:<< parameters.node-version >>"
steps:
- attach_workspace:
at: .
- restore_cache:
name: Restore npm Package Cache
keys:
- "npm-<< parameters.node-version >>-{{ checksum \"package-lock.json\" }}"
- run:
name: Move node_modules to correct location for install
command: "[ ! -d \"node_modules_<< parameters.node-version >>\" ] || mv \"node_modules_<< parameters.node-version >>\" node_modules"
- run:
name: Install Dependencies
command: npm install
- run:
name: Move node_modules to correct location for cache
command: mv node_modules "node_modules_<< parameters.node-version >>"
- save_cache:
name: Save npm Package Cache
key: "npm-<< parameters.node-version >>-{{ checksum \"package-lock.json\" }}"
paths:
- "node_modules_<< parameters.node-version >>"
- persist_to_workspace:
root: .
paths:
- "node_modules_<< parameters.node-version >>"
build:
<<: *defaults
docker:
- image: "cimg/node:lts"
steps:
- checkout
- restore_cache:
name: Restore npm Package Cache
keys:
- "npm-{{ checksum \"package-lock.json\" }}"
- run:
name: Install Dependencies
command: npm install
- run:
name: Build the Framework
command: npm run build
- save_cache:
name: Save Build Cache
key: build-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- css
- save_cache:
name: Save npm Package Cache
key: "npm-{{ checksum \"package-lock.json\" }}"
paths:
- "node_modules"
- persist_to_workspace:
root: .
paths:
- css
- store_artifacts:
path: css
build-in-all-supported-versions-of-node:
<<: *defaults
parameters:
node-version:
type: string
docker:
- image: "cimg/node:<< parameters.node-version >>"
steps:
- attach_workspace:
at: .
- run:
name: Move node_modules to correct location for build
command: "[ ! -d \"node_modules_<< parameters.node-version >>\" ] || mv \"node_modules_<< parameters.node-version >>\" node_modules"
- run:
name: Build the Framework
command: npm run build
- store_artifacts:
path: css
lint:
<<: *defaults
docker:
- image: "cimg/node:lts"
steps:
- attach_workspace:
at: .
- run:
command: npm i -D stylelint-config-prettier stylelint-config-recess-order stylelint-config-standard stylelint-prettier stylelint-scss
- run:
name: Lint styles
command: npx stylelint scss/**/*.scss "--fix"
# test:
# <<: *defaults
# steps:
# - attach_workspace:
# at: .
# - run:
# name: Add Yarn Binary Folder To $PATH
# command: export PATH="$PATH:`yarn global bin`"
# - run:
# name: Run tests
# command: yarn test
# coverage:
# <<: *defaults
# steps:
# - attach_workspace:
# at: .
# - run:
# name: Add Yarn Binary Folder To $PATH
# command: export PATH="$PATH:`yarn global bin`"
# - run:
# name: Generate and upload coverage report
# command: yarn test-coverage
release:
<<: *defaults
docker:
- image: cimg/node:lts
steps:
- attach_workspace:
at: .
- run:
command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
- run:
name: Release
command: npx semantic-release
workflows:
version: 2
main:
jobs:
- checkout
- commitlint:
filters:
branches:
ignore: master
- install-dependencies:
requires:
- checkout
matrix:
parameters:
<<: *supported-node-versions
# - test:
# requires:
# - install-dependencies
# - coverage:
# requires:
# - install-dependencies
- lint:
requires:
- checkout
- build
- build-in-all-supported-versions-of-node:
requires:
- install-dependencies
matrix:
parameters:
<<: *supported-node-versions
- release:
requires:
- commitlint
- build
- build-in-all-supported-versions-of-node
- lint
# - test
filters:
branches:
only: master