-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from particle-iot/feature/sc-102023/migrate-p…
…article-cli-to-circleci Migrate particle-cli to CircleCI
- Loading branch information
Showing
20 changed files
with
418 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
linux: | ||
docker: | ||
- image: cimg/base:2022.04 | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
macos: | ||
macos: | ||
xcode: 13 | ||
|
||
orbs: | ||
node: circleci/node@5.0.2 | ||
win: circleci/windows@4.1.1 | ||
|
||
commands: | ||
configure-npm-token: | ||
description: "A command to configure NPM Token" | ||
steps: | ||
- run: | ||
name: Configure NPM Token | ||
command: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN | ||
install-node: | ||
description: "A command to install node" | ||
parameters: | ||
node-version: | ||
type: string | ||
steps: | ||
- checkout | ||
- node/install: | ||
node-version: << parameters.node-version >> | ||
- configure-npm-token | ||
- node/install-packages: | ||
cache-path: node_modules | ||
run-tests: | ||
description: "A command to install node and run tests" | ||
parameters: | ||
node-version: | ||
type: string | ||
test-command: | ||
type: string | ||
steps: | ||
- install-node: | ||
node-version: << parameters.node-version >> | ||
- run: | ||
name: Run Tests | ||
command: npm run << parameters.test-command >> | ||
|
||
jobs: | ||
test-unix: | ||
parameters: | ||
os: | ||
type: executor | ||
node-version: | ||
type: string | ||
executor: << parameters.os >> | ||
steps: | ||
- run-tests: | ||
node-version: << parameters.node-version >> | ||
test-command: test:ci | ||
test-windows: | ||
parameters: | ||
node-version: | ||
type: string | ||
executor: win/default | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install Node | ||
command: | | ||
nvm install --lts << parameters.node-version >> | ||
nvm use << parameters.node-version >> | ||
- configure-npm-token | ||
- run: | ||
name: Install packages | ||
command: npm ci | ||
- run: | ||
name: Run Tests | ||
command: npm run test:ci | ||
test-e2e: | ||
parameters: | ||
os: | ||
type: executor | ||
node-version: | ||
type: string | ||
executor: << parameters.os >> | ||
steps: | ||
- run-tests: | ||
node-version: << parameters.node-version >> | ||
test-command: test:e2e:ci | ||
test-coverage: | ||
parameters: | ||
os: | ||
type: executor | ||
node-version: | ||
type: string | ||
executor: << parameters.os >> | ||
steps: | ||
- install-node: | ||
node-version: << parameters.node-version >> | ||
- run: | ||
name: Generate Coverage Report | ||
command: npm run coverage | ||
- store_artifacts: | ||
path: coverage | ||
# Copied from following repos | ||
# https://github.com/particle-iot-inc/cache-aside/blob/2ee9e2d77138f1a9d22a7d604e7f8cc0d45f016e/.circleci/config.yml | ||
# https://github.com/particle-iot-inc/app-metrics/blob/034e6dd5d77ce3b0683310c81e6f6994be2d1c80/.circleci/config.yml | ||
# https://github.com/particle-iot-inc/device-service-discovery/blob/d1f4dbcdcab1efba7ba92794670c6e4e973e6265/.circleci/config.yml | ||
publish-npm: | ||
working_directory: ~/repo | ||
docker: | ||
- image: cimg/node:12.22 # Primary execution image | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
steps: | ||
- attach_workspace: | ||
at: ~/repo | ||
- configure-npm-token | ||
- run: | ||
name: Publish package | ||
command: | | ||
# Publish as beta for pre-release tags like v1.2.3-pre.1 | ||
[[ $CIRCLE_TAG =~ ^v.*- ]] && NPM_TAG=--tag=beta | ||
npm publish $NPM_TAG | ||
workflows: | ||
version: 2 | ||
test-and-publish: | ||
jobs: | ||
- test-unix: | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
os: [linux, macos] | ||
node-version: ["10", "12", "14", "16"] | ||
- test-windows: | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
node-version: ["10", "12", "14", "16"] | ||
- test-e2e: | ||
name: test-e2e-linux | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
os: [linux] | ||
node-version: ["12"] | ||
- test-e2e: | ||
name: test-e2e-macos | ||
requires: | ||
- test-e2e-linux | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
os: [macos] | ||
node-version: ["12"] | ||
- test-coverage: | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
os: [linux] | ||
node-version: ["12"] | ||
- publish-npm: | ||
requires: | ||
- test-unix | ||
- test-windows | ||
- test-e2e-linux | ||
- test-e2e-macos | ||
context: | ||
- particle-ci-private | ||
# publish for tags only | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ es6 | |
.nvmrc | ||
appveyor.yml | ||
development.md | ||
.circleci |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.