Skip to content

Commit

Permalink
Switch to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
tnorling committed May 21, 2021
1 parent 9eab0f4 commit f9ad0c8
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 58 deletions.
77 changes: 45 additions & 32 deletions .github/workflows/build-steps.yml
Expand Up @@ -19,22 +19,50 @@ concurrency:
cancel-in-progress: true

jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'packages' output variable
packages: ${{ steps.filter.outputs.changes }}

steps:
- uses: dorny/paths-filter@v2
id: filter
with:
# &common and &browser are YAML anchors
# *common and *browser references previously defined anchor
# browser/node filter will match any path under common as well as their own
# angular/react filter will match any path under common and browser as well as their own
filters: |
core:
- 'lib/msal-core/**/**.!(md)'
- '.github/workflows/build-steps.yml'
common: &common
- 'lib/msal-common/**/**.!(md)'
- '.github/workflows/build-steps.yml'
browser: &browser
- *common
- 'lib/msal-browser/**/**.!(md)'
node:
- *common
- 'lib/msal-node/**/**.!(md)'
angular:
- *browser
- 'lib/msal-angular/**/**.!(md)'
react:
- *browser
- 'lib/msal-react/**/**.!(md)'
build-test:
needs: pre-check
runs-on: ubuntu-latest
env:
NOT_FROM_FORK: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push'))

strategy:
fail-fast: false
matrix:
library:
- msal-core
- msal-common
- msal-browser
- msal-node
- msal-angular
- msal-react
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['package1', 'package2'] if both package folders contains changes
library: ${{ fromJSON(needs.pre-check.outputs.packages) }}

steps:
- uses: actions/checkout@v2
Expand All @@ -48,35 +76,20 @@ jobs:
run: npm ci

- name: Build packages
working-directory: lib/${{ matrix.library }}
working-directory: lib/msal-${{ matrix.library }}
run: npm run build:all

- name: Lint
working-directory: lib/${{ matrix.library }}
working-directory: lib/msal-${{ matrix.library }}
run: npm run lint

- name: Unit Tests with coverage
working-directory: lib/${{ matrix.library }}
working-directory: lib/msal-${{ matrix.library }}
run: npm run test:coverage

- name: Coveralls
if: success() && ${{ env.NOT_FROM_FORK == 'true' }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: ${{ matrix.library }}
base-path: lib/${{ matrix.library }}
path-to-lcov: lib/${{ matrix.library }}/coverage/lcov.info
parallel: true

Coveralls:
needs: build-test
runs-on: ubuntu-latest
if: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push'))

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
- name: Upload Test Coverage to CodeCov
if: success()
uses: codecov/codecov-action@v1
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
files: lib/msal-${{matrix.library}}/coverage/lcov.info
flags: msal-${{ matrix.library }}
11 changes: 11 additions & 0 deletions codecov.yml
@@ -0,0 +1,11 @@
comment:
layout: "flags, files"
behavior: default
require_changes: false
require_base: no
require_head: no
show_carryforward_flags: true

flag_management:
default_rules:
carryforward: true
25 changes: 0 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -18,7 +18,6 @@
"@typescript-eslint/parser": "^4.0.1",
"babel-plugin-istanbul": "^5.2.0",
"beachball": "^1.45.0",
"coveralls": "3.0.9",
"dotenv": "^8.2.0",
"eslint": "^7.8.1",
"eslint-plugin-header": "^3.1.0",
Expand Down

0 comments on commit f9ad0c8

Please sign in to comment.