Skip to content

Commit

Permalink
build: Adding code coverage reports pipeline (#1286)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek authored May 2, 2024
1 parent fd0c7ad commit ea6d230
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 📊 Code Coverage

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-latest

env:
CODE_TYPE: stable
CODE_VERSION: max
TEST_RESOURCES: test-resources

steps:
- name: 👷🏻 Checkout Repository
uses: actions/checkout@v4

- name: ⚙️ Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: npm

- name: 🔧 Install
run: npm ci

- name: 🔧 Build
run: npm run build

- name: 🔧 Install - Test Project
run: npm install --workspace=extester-test

- name: 📊 Run Tests with Coverage enabled
# 'set +e' and 'exit 0' - that means the workflow will not fail even the test failures are present. The failing tests are not directive for the code coverage reports itself
run: |
set +e
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run test:coverage
exit 0
- name: 💾 Upload Coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: ${{ github.workspace }}/tests/**/coverage
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build": "lerna run build",
"build:changed": "lerna run build --since main",
"test": "npm run ui-test --workspace=extester-test",
"test:coverage": "npm run test -- -- --coverage",
"test:coverage": "npm run ui-test:coverage --workspace=extester-test",
"test:build": "npm run build:changed && npm install --workspace=extester-test && npm test"
},
"workspaces": [
Expand Down
3 changes: 2 additions & 1 deletion tests/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@
"compile": "tsc -p ./ && npm run lint",
"lint": "eslint src --ext .ts",
"cb-init": "echo hello_ExTester | clipboard",
"ui-test": "npm run cb-init && extest setup-and-run './out/test/cli/order-3.test.js' './out/test/cli/order-2.test.js' './out/test/cli/order-1.test.js' './out/test/**/*.test.js' './out/test/system/clipboard.test.js' -u -i -r . -e ./test-extensions"
"ui-test": "npm run cb-init && extest setup-and-run './out/test/cli/order-3.test.js' './out/test/cli/order-2.test.js' './out/test/cli/order-1.test.js' './out/test/**/*.test.js' './out/test/system/clipboard.test.js' -u -i -r . -e ./test-extensions",
"ui-test:coverage": "MOCHA_GREP='order|clipboard|ExtensionsView|TitleBar' MOCHA_INVERT=true extest setup-and-run './out/test/**/*.test.js' -i -r . -e ./test-extensions --coverage"
},
"devDependencies": {
"@types/chai": "^4.3.14",
Expand Down
4 changes: 2 additions & 2 deletions tests/test-project/src/test/debug/debug.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActivityBar, BottomBarPanel, Breakpoint, BreakpointSectionItem, DebugConsoleView, DebugToolbar, DebugView, EditorView, error, Key, TextEditor, TitleBar, until, VSBrowser, WebDriver, Workbench } from 'vscode-extension-tester';
import { ActivityBar, BottomBarPanel, Breakpoint, BreakpointSectionItem, DebugConsoleView, DebugToolbar, DebugView, EditorView, error, Key, TextEditor, until, VSBrowser, WebDriver, Workbench } from 'vscode-extension-tester';
import * as path from 'path';
import { expect } from "chai";

Expand Down Expand Up @@ -28,7 +28,7 @@ describe('Debugging', function () {
await (await new ActivityBar().getViewControl('Run and Debug'))?.closeView();
await new BottomBarPanel().toggle(false);

await new TitleBar().select('File', 'Close Folder');
await new Workbench().executeCommand('Workspaces: Close Workspace');
await new Promise(res => setTimeout(res, 5000));
});

Expand Down

0 comments on commit ea6d230

Please sign in to comment.