Skip to content

Commit

Permalink
Coverage report posted to codecov (#156)
Browse files Browse the repository at this point in the history
 feat: add codecov tracking service
  • Loading branch information
haifeng-li-at-salesforce authored Nov 15, 2024
1 parent b3f46ad commit 0342212
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 38 deletions.
80 changes: 43 additions & 37 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
name: run-tests
run-name: Installs project and runs project tests
on: [ push, pull_request ]
on: [push, pull_request]
jobs:
run-tests-nix:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 20, 22 ]
name: Tests with code coverage on Ubuntu with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: |
npm install
npm run compile
# runtTests() which downloads/installs/launches VSCode requires a screen.
# Using xvfb-run to attach a virtual screen for CI running on Ubuntu.
xvfb-run --server-num=99 --server-args="-screen 0 1024x768x24" npm run test-coverage
shell: bash
- run: killall Xvfb || true
run-tests-win:
runs-on: windows-latest
strategy:
matrix:
node: [ 20, 22 ]
name: Tests with code coverage on Windows with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: |
# On Windows there no need for a screen for runTests() to run successfully.
npm install
npm run compile
npm run test-coverage
- run: taskkill /IM Xvfb.exe /F || true
run-tests-nix:
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
name: Tests with code coverage on Ubuntu with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: |
npm install
npm run compile
# runtTests() which downloads/installs/launches VSCode requires a screen.
# Using xvfb-run to attach a virtual screen for CI running on Ubuntu.
xvfb-run --server-num=99 --server-args="-screen 0 1024x768x24" npm run test-coverage
shell: bash
- run: killall Xvfb || true
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/*.json
flags: lsp,extension
run-tests-win:
runs-on: windows-latest
strategy:
matrix:
node: [20, 22]
name: Tests with code coverage on Windows with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: |
# On Windows there no need for a screen for runTests() to run successfully.
npm install
npm run compile
npm run test-coverage
- run: taskkill /IM Xvfb.exe /F || true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![codecov](https://codecov.io/github/salesforce/salesforcedx-vscode-mobile/branch/main/graph/badge.svg?token=PDZHP80RNO)](https://codecov.io/github/salesforce/salesforcedx-vscode-mobile)

# Salesforce Mobile Extensions for Visual Studio Code

This Visual Studio Code extension provides tools to help developers create their Salesforce Mobile experiences in the VSCode development environment.
Expand Down
18 changes: 18 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2024, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: MIT
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
comment:
layout: 'header, diff, tree'
behavior: default
require_changes: false # if true: only post the comment if coverage changes
branches: null
flags: null
paths: null
flags:
extension:
paths:
- src/
lsp:
paths:
- lsp/
2 changes: 1 addition & 1 deletion test/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function run(): Promise<void> {
nyc = new NYC({
...baseConfig,
cwd: path.join(__dirname, '..', '..', '..'),
reporter: ['text-summary', 'html', 'text', 'lcov'],
reporter: ['text-summary', 'html', 'text', 'lcov', 'json'],
all: true,
silent: false,
instrument: true,
Expand Down

0 comments on commit 0342212

Please sign in to comment.