Skip to content

Commit

Permalink
move coverage to new workflow only run main
Browse files Browse the repository at this point in the history
  • Loading branch information
aacebo committed Jan 3, 2024
1 parent b004615 commit d277769
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 40 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#
# This workflow will run a coverage report
#

name: Coverage

on:
workflow_dispatch:
push:
branches: ['main']
paths: [
'.github/workflows/js-*.yml',
'js/**',
.github/workflows/dotnet-*.yml,
'dotnet/**'
]

permissions: read-all

jobs:
javascript:
name: Javascript
runs-on: ubuntu-latest
environment: main
env:
node-version: 18.x
defaults:
run:
shell: bash
working-directory: js/
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup NodeJS ${{ env.node-version }}
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: ${{ env.node-version }}
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Test
run: yarn test:nyc:report
- name: Coveralls
uses: coverallsapp/[email protected]
with:
flag-name: javascript
parallel: true
files: js/coverage/lcov.info

dotnet:
name: DotNet
runs-on: windows-latest
environment: main
env:
dotnet-version: 7.0
SOLUTION_DIR: dotnet/packages/Microsoft.TeamsAI/
defaults:
run:
shell: bash
working-directory: dotnet/packages/Microsoft.TeamsAI/
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup .NET ${{ env.dotnet-version }}
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: ${{ env.dotnet-version }}
- name: Test
run: dotnet test Microsoft.TeamsAI.Tests/Microsoft.Teams.AI.Tests.csproj --verbosity normal --logger trx --results-directory ./TestResults --collect:"XPlat Code Coverage" --configuration Release
- name: Coverage
uses: danielpalme/ReportGenerator-GitHub-Action@4d510cbed8a05af5aefea46c7fd6e05b95844c89 # 5.2.0
with:
reports: ${{ env.SOLUTION_DIR }}TestResults/*/coverage.cobertura.xml
targetdir: ${{ env.SOLUTION_DIR }}TestResults/coverage
reporttypes: 'HtmlInline;lcov'
toolpath: ${{ env.SOLUTION_DIR }}report-generator-tool
- name: Coveralls
uses: coverallsapp/[email protected]
with:
flag-name: dotnet
parallel: true
files: ${{ env.SOLUTION_DIR }}TestResults/coverage/lcov.info
carryforward: dotnet
- name: Upload Tests
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: testresults-dotnet-${{ env.dotnet-version }}
path: ${{ env.SOLUTION_DIR }}TestResults

finish:
needs: [javascript, dotnet]
if: ${{ always() }}
runs-on: ubuntu-latest
environment: main
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: 'javascript,dotnet'
20 changes: 0 additions & 20 deletions .github/workflows/dotnet-build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
build-test-lint:
name: Build/Test/Lint
runs-on: windows-latest
environment: main
strategy:
matrix:
dotnet-version: ['6.0', '7.0']
Expand Down Expand Up @@ -50,13 +49,6 @@ jobs:
targetdir: ${{ env.SOLUTION_DIR }}TestResults/coverage
reporttypes: 'HtmlInline;lcov'
toolpath: ${{ env.SOLUTION_DIR }}report-generator-tool
- name: Coveralls
uses: coverallsapp/[email protected]
with:
flag-name: dotnet
parallel: true
files: ${{ env.SOLUTION_DIR }}TestResults/coverage/lcov.info
carryforward: dotnet
- name: Upload Tests
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
Expand All @@ -66,15 +58,3 @@ jobs:
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

finish:
needs: build-test-lint
if: ${{ always() }}
runs-on: ubuntu-latest
environment: main
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: 'javascript,dotnet'
21 changes: 1 addition & 20 deletions .github/workflows/js-build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
build-test-lint:
name: Build/Test/Lint
runs-on: ubuntu-latest
environment: main
strategy:
matrix:
node-version: [16.x, 18.x]
Expand All @@ -39,28 +38,10 @@ jobs:
- name: Build
run: yarn build
- name: Test
run: yarn test:nyc:report
- name: Coveralls
uses: coverallsapp/[email protected]
with:
flag-name: javascript
parallel: true
files: js/coverage/lcov.info
run: yarn test
- name: Lint
run: yarn lint
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

finish:
needs: build-test-lint
if: ${{ always() }}
runs-on: ubuntu-latest
environment: main
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: 'javascript,dotnet'

0 comments on commit d277769

Please sign in to comment.