Skip to content

Commit

Permalink
Merge pull request conventional-changelog#127 from verdaccio/refactor-ci
Browse files Browse the repository at this point in the history
chore: refactor ci
  • Loading branch information
sergiohgz authored Sep 11, 2019
2 parents 2890e5a + de0f91a commit 3a889b6
Show file tree
Hide file tree
Showing 8 changed files with 2,043 additions and 2,878 deletions.
112 changes: 50 additions & 62 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
version: 2

aliases:
- &repo_path
~/ui-theme
- &defaults
working_directory: ~/ui-theme
- &node11_executor
working_directory: *repo_path
- &node_latest_executor
docker:
- image: circleci/node:11.10.1
- &node8_executor
- image: circleci/node:latest
- &node_lts_executor
docker:
- image: circleci/node:8
- &node10_executor
docker:
- image: circleci/node:10
- image: circleci/node:lts
- &default_executor
<<: *node10_executor
- &repo_key
repo-{{ .Branch }}-{{ .Revision }}
- &coverage_key
coverage-{{ .Branch }}-{{ .Revision }}
- &base_config_key
base-config-{{ .Branch }}-{{ .Revision }}
<<: *node_latest_executor
- &yarn_cache_key
yarn-sha-{{ checksum "yarn.lock" }}
- &coverage_key
coverage-{{ .Branch }}-{{ .Revision }}
- &restore_repo
restore_cache:
keys:
- *repo_key
attach_workspace:
at: *repo_path
- &ignore_non_dev_branches
filters:
tags:
Expand All @@ -36,7 +30,7 @@ aliases:
- &execute_on_release
filters:
tags:
only: /(v)?[0-9]+(\.[0-9]+)*/
only: /v?[0-9]+(\.[0-9]+)*([-+\.][a-zA-Z0-9]+)*/
branches:
ignore:
- /.*/
Expand All @@ -48,21 +42,11 @@ jobs:
steps:
- *restore_repo
- checkout
- restore_cache:
key: *base_config_key
- run:
name: 'Base environment setup'
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- save_cache:
key: *base_config_key
paths:
- ~/.npmrc
- ~/.gitconfig
- restore_cache:
key: *yarn_cache_key
- run:
name: Install Js dependencies
command: yarn install --no-progress --registry https://registry.verdaccio.org --no-lockfile
name: Install dependencies
command: yarn install --frozen-lockfile
- run:
name: Build project
command: yarn run build
Expand All @@ -72,49 +56,50 @@ jobs:
- ~/.yarn
- ~/.cache/yarn
- node_modules
- save_cache:
key: *repo_key
- persist_to_workspace:
root: *repo_path
paths:
- ~/ui-theme
test_bundlesize:
- ./*

lint:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- run:
name: Test BundleSize
command: yarn test:size
name: Lint code
command: yarn lint

test_node11:
test_bundlesize:
<<: *defaults
<<: *node11_executor
<<: *default_executor
steps:
- *restore_repo
- run:
name: Test with Node 11
command: yarn test
name: Test BundleSize
command: yarn test:size

test_node8:
test_node_latest:
<<: *defaults
<<: *node8_executor
<<: *node_latest_executor
steps:
- *restore_repo
- run:
name: Test with Node 8
name: Test with Node (Latest)
command: yarn test
- save_cache:
key: *coverage_key
paths:
- coverage

test_node10:
test_node_lts:
<<: *defaults
<<: *node10_executor
<<: *node_lts_executor
steps:
- *restore_repo
- run:
name: Test with Node 10
command: yarn run test
- save_cache:
key: *coverage_key
paths:
- coverage
name: Test with Node (LTS)
command: yarn test

coverage:
<<: *defaults
Expand All @@ -140,8 +125,9 @@ jobs:
<<: *default_executor
steps:
- *restore_repo
- restore_cache:
key: *base_config_key
- run:
name: 'Setup publish credentials'
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run:
name: Publish
command: yarn publish
Expand All @@ -152,29 +138,31 @@ workflows:
jobs:
- prepare:
<<: *ignore_non_dev_branches
- test_node11:
- lint:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node8:
- test_bundlesize:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node10:
- test_node_latest:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_bundlesize:
- test_node_lts:
requires:
- test_node11
- test_node8
- test_node10
- prepare
<<: *ignore_non_dev_branches
- coverage:
requires:
- test_bundlesize
- test_node_latest
<<: *ignore_non_dev_branches
- publish_package:
requires:
- lint
- test_bundlesize
- test_node_latest
- test_node_lts
- coverage
<<: *execute_on_release
67 changes: 0 additions & 67 deletions .github/main.workflow

This file was deleted.

30 changes: 15 additions & 15 deletions .github/workflows/nodejs.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Node CI
name: CI

on: [push]
on: push

jobs:
ci:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
build_test_lint:
name: Node ${{ matrix.node_version }} and ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node_version: [8, 10, 12]
node_version: [10, 12]
os: [ubuntu-latest, windows-latest, macOS-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
version: ${{ matrix.node_version }}

- name: Use Yarn 1.17.2
run: |
npm install -g [email protected]
- name: yarn build
run: |
yarn install
yarn lint
yarn build
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Lint
run: yarn lint
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"endOfLine": "auto",
"useTabs": false,
"printWidth": 160,
"tabWidth": 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"test:size": "bundlesize",
"lint": "npm run lint:js && npm run lint:css",
"lint:js": "npm run type-check && eslint . --ext .js,.ts,.tsx",
"lint:css": "stylelint 'src/**/styles.ts'",
"lint:css": "stylelint \"src/**/styles.ts\"",
"coverage:publish": "codecov",
"pre:webpack": "rimraf static/*",
"prepublish": "in-publish && npm run build || not-in-publish",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Versions/Versions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ describe('<Version /> component', () => {
cleanup();
});

test('should render the component in default state', () => {
// FIXME: this test is not deterministic (writes `N days ago` in the snapshot, where N is random number)
test.skip('should render the component in default state', () => {
const wrapper = mount(
<MemoryRouter>
<Versions />
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 3a889b6

Please sign in to comment.