Skip to content

Commit

Permalink
chore: update github action code climate (microsoft#3020)
Browse files Browse the repository at this point in the history
* update to improve speed of filing PR

* Revert "update to improve speed of filing PR"

This reverts commit 83c177e.

* update to try code climate reporter GH Action

* update to next minor version

* update string array

* update to install latest lerna

* update coverageCommand

* update to not run helpers unit testing so I can validate issues with coverage

* update to run tests on packages only

* update to properly format for an 'action' input string

* added testing script

* updated to use new format provided by MartinNuc

* updated to test alternative option

* update version for codeclimate-action

* update jest configurations to support monorepositories

* update documentation for testing

* update ci-daily with performance improvements

* update to declutter, cleanup, and perf improvements

* update to mark with a branch so hopefully does not fire a run

* updates to resolve broken coverage mappings

* update configuration to reduce errors

* remove prettier upgrade as dev dep

* remove produciton flag

* update to revert back to working pipeline

* update to coverage locations

* update formatting mishap
  • Loading branch information
awentzel authored Apr 28, 2020
1 parent cbbb2cf commit 74ced80
Show file tree
Hide file tree
Showing 24 changed files with 328 additions and 1,696 deletions.
1 change: 1 addition & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-P ubuntu-latest=nektos/act-environments-ubuntu:18.04
62 changes: 27 additions & 35 deletions .github/workflows/ci-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ on:
jobs:
build_linux:
runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32

steps:
- uses: actions/checkout@v2

- name: Install Lerna
run: sudo yarn global add lerna@3.18.2
- name: Add or Update packages
run: sudo yarn global add lerna@3.18.2

# Cache yarn dependencies
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo '::set-output name=dir::$(yarn cache dir)'

- name: Set up node_modules cache
uses: actions/cache@v1.1.2
id: yarn-cache
Expand All @@ -44,32 +42,26 @@ jobs:
- name: Testing unit tests
run: lerna run test --stream

# Stop reporting to Code Climate until a resolution exists for incompatabilities with Jest 25.x
# as described in https://github.com/codeclimate/test-reporter/issues/427
# - name: Install Code Climate
# run: |
# if [ ! -f ./coverage/cc-test-reporter ]; then
# mkdir -p ./coverage/
# curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./coverage/cc-test-reporter
# chmod +x ./coverage/cc-test-reporter
# fi

# - name: Notify Code Climate that a build is starting
# run: ./coverage/cc-test-reporter before-build

# - name: Collect coverage reports
# run: |
# for f in packages/*; do
# if [ -d "$f" ]; then
# echo $f
# set +e
# if [ -d "$f/coverage" ]; then
# ./coverage/cc-test-reporter format-coverage -t lcov -o coverage/coverage.${f//\//-}.json $f/coverage/lcov.info
# fi
# fi
# done;

# - name: Summarize and upload code coverage
# run: |
# ./coverage/cc-test-reporter sum-coverage -o coverage/coverage.total.json coverage/coverage.*.json
# ./coverage/cc-test-reporter upload-coverage -i coverage/coverage.total.json
- name: Collect and upload code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.6.0
env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32
with:
coverageCommand: lerna run coverage
coverageLocations: |
${{github.workspace}}/packages/react/fast-components-foundation-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-react-base/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-react-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-styles-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-manager/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-manager-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-layouts-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-react-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-animation/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-colors/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-web-utilities/coverage/lcov.info:lcov
${{github.workspace}}/sites/fast-component-explorer/coverage/lcov.info:lcov
debug: false
38 changes: 38 additions & 0 deletions .github/workflows/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Local testing of GitHub Actions
Leverage the knowledge from https://github.com/nektos/act for detailed instructions.

## Install
### 1. Install Docker
Required to run GitHub Actions on VMs. Choose your preferred Docker setup https://docs.docker.com/get-docker/.

### 2. Install Nektos
Required to run GitHub Actions locally.

```bash
$ brew install nektos/tap/act
```

### 3. Install Azure CLI
Required to integrate GitHub Actions and Azure.

```bash
$ azure login
```

## Configure
The `.actrc` file contains the default configuration and run methods. The `./.github/workflows/testing/push.json` file contains the default GitHub events to run.

Update the "ref" values in `./.github/workflows/testing/push.json` to point to the local git branch to test. Then perform the following to execute against that branch when running `act`.

Run the event from the `/testing/*` folder as indicated with `-W` or `--workflows` arguments.

```bash
$ act -e `./.github/workflows/testing/push.json` -W "./.github/workflows/testing/"
```

## Test
`./.github/workflows/testing/ci-daily-local.yml` is used to test locally CI settings.

```bash
$ act -j build_local_linux -e "./.github/workflows/testing/push.json" -W "./.github/workflows/testing/"
```
50 changes: 50 additions & 0 deletions .github/workflows/testing/ci-daily-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI - FAST Local Testing

on:
push:
branches:
- users/*

jobs:
build_local_linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Add/Update packages
run: |
sudo apt-get update
sudo apt-get install yarn
sudo yarn global upgrade typescript
sudo yarn global add lerna
- name: Install package dependencies / prepare workspaces
run: yarn install --frozen-lockfile

- name: Testing units
run: lerna run test --stream

- name: Collect and upload code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.6.0
env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32
with:
coverageCommand: lerna run coverage
coverageLocations: |
${{github.workspace}}/packages/react/fast-components-foundation-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-react-base/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-react-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-components-styles-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-manager/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-manager-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-jss-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-layouts-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/fast-react-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-animation/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-colors/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-web-utilities/coverage/lcov.info:lcov
${{github.workspace}}/sites/fast-component-explorer/coverage/lcov.info:lcov
debug: true
10 changes: 10 additions & 0 deletions .github/workflows/testing/push.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"push": {
"head": {
"ref": "users/awentzel/update-action-cc"
},
"base": {
"ref": "users/awentzel/update-action-cc"
}
}
}
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
}
},
"jest": {
"collectCoverage": true,
"collectCoverage": false,
"collectCoverageFrom": [
"build/helpers/*.ts"
],
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "."}
]
],
"coverageThreshold": {
"global": {
"statements": 100,
Expand All @@ -64,7 +70,8 @@
],
"testPathIgnorePatterns": [
"packages/",
"build/helpers/__tests__/*"
"build/helpers/__tests__/*",
"build/helpers/"
],
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js?|ts?)$",
"moduleFileExtensions": [
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-components-foundation-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"build": "tsc -p ./tsconfig.build.json",
"clean:dist": "node ../../../build/clean.js dist",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,tsx}\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,tsx}\" --list-different",
Expand All @@ -32,6 +33,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 80,
Expand Down
9 changes: 8 additions & 1 deletion packages/react/fast-components-react-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"copy:all": "yarn convert:json-schema && yarn copy:readme",
"convert:json-schema": "node ../../../build/convert-schemas.js",
"copy:readme": "node ../../../build/copy-readme.js",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,tsx}\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,tsx}\" --list-different",
Expand All @@ -36,7 +37,13 @@
"watch": "tsc -p ./tsconfig.json -w --preserveWatchOutput"
},
"jest": {
"collectCoverage": true,
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 80,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-components-react-msft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"copy:all": "yarn convert:json-schema && yarn copy:readme",
"convert:json-schema": "node ../../../build/convert-schemas.js",
"copy:readme": "node ../../../build/copy-readme.js",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,tsx}\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,tsx}\" --list-different",
Expand All @@ -40,6 +41,12 @@
"./mock.js"
],
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 95,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-components-styles-msft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"clean:dist": "node ../../../build/clean.js dist",
"clean:tmp": "node ../../../build/clean.js .tmp",
"coverage": "jest --coverage",
"eslint": "eslint . --ext .ts",
"eslint:fix": "eslint . --ext .ts --fix",
"test": "yarn eslint && yarn unit-tests",
Expand All @@ -35,6 +36,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 80,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-jss-manager-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"build": "tsc -p ./tsconfig.build.json",
"clean:dist": "node ../../../build/clean.js dist",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,tsx}\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,tsx}\" --list-different",
Expand All @@ -33,6 +34,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 81,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-jss-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"build": "tsc -p ./tsconfig.build.json",
"clean:dist": "node ../../../build/clean.js dist",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different",
Expand Down Expand Up @@ -55,6 +56,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 100,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-jss-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"build": "tsc -p ./tsconfig.build.json",
"clean:dist": "node ../../../build/clean.js dist",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different",
Expand All @@ -31,6 +32,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 100,
Expand Down
7 changes: 7 additions & 0 deletions packages/react/fast-layouts-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"build": "tsc -p ./tsconfig.build.json",
"build:app": "webpack --progress --mode=production",
"clean:dist": "node ../../../build/clean.js dist",
"coverage": "jest --coverage",
"prepare": "yarn clean:dist && yarn build",
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,tsx}\"",
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,tsx}\" --list-different",
Expand All @@ -35,6 +36,12 @@
},
"jest": {
"collectCoverage": true,
"coverageReporters": [
"json",
[
"lcov", {"projectRoot": "../../../"}
]
],
"coverageThreshold": {
"global": {
"statements": 71,
Expand Down
Loading

0 comments on commit 74ced80

Please sign in to comment.