Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI workflow & send coverage to Codecov #85

Merged
merged 9 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: CI

on:
push:
branches: [$default-branch]
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'plugins/**'
- 'src/**'
- 'test/**'
- '.babelrc'
- '.browserslistrc'
- '.prettierrc'
- 'karma.conf.js'
Expand All @@ -17,14 +16,13 @@ on:
- 'rollup.config.js'
- 'tsconfig.json'
pull_request:
branches: [$default-branch]
branches: [main]
types: [opened, synchronize, reopened]
paths:
- '.github/workflows/ci.yml'
- 'plugins/**'
- 'src/**'
- 'test/**'
- '.babelrc'
- '.browserslistrc'
- '.prettierrc'
- 'karma.conf.js'
Expand All @@ -45,19 +43,25 @@ jobs:
os: [windows-latest, macOS-latest]

steps:
- name: Checkout project code
- name: Checkout Project Code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Use NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Installation
- name: Install
run: npm ci
- name: Linting & Typechecking
- name: Lint & Typecheck
run: npm run typecheck
- name: Testing
- name: Test
run: npm run test:coverage
env:
CI: true
- name: Send Coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: .coverage/lcov.info
flags: unittests
fail_ci_if_error: true
23 changes: 9 additions & 14 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Generated on Sun Jan 20 2019 23:06:22 GMT-0600 (CST)
const rollupCommonjs = require('@rollup/plugin-commonjs');
const rollupNodeResolve = require('@rollup/plugin-node-resolve').default;
const rollupPluginBabel = require('@rollup/plugin-babel').default;
const rollupPluginTypescript = require('@rollup/plugin-typescript');
const rollupPluginBabel = require('@rollup/plugin-babel').default;
const rollupPluginInstrumentTsCode = require('./plugins/rollup-plugin-instrument-ts-code');
const rollupPluginInjectCode = require('./plugins/rollup-plugin-inject-code');

const isCI = !!process.env.CI;
const watch = !!process.argv.find((arg) => arg.includes('watch')) && !isCI;
Expand Down Expand Up @@ -80,14 +82,11 @@ module.exports = (config) => {
autoWatch: watch,

coverageIstanbulReporter: {
reports: ['html', 'lcovonly'],
reports: isCI ? ['lcovonly'] : ['html'],
dir: '.coverage',
includeAllSources: true,
combineBrowserReports: true,
skipFilesWithNoCoverage: true,
'report-config': {
html: {subdir: 'html'},
lcovonly: {subdir: 'lcov'},
},
},

customLaunchers: {
Expand Down Expand Up @@ -162,15 +161,10 @@ module.exports = (config) => {
}),
rollupPluginTypescript({
isolatedModules: true,
tsconfig: require.resolve('./tsconfig.build.json'),
}),
rollupPluginBabel({
babelHelpers: 'bundled',
babelrc: false,
extensions,
plugins: [coverage && 'babel-plugin-istanbul'].filter(Boolean),
tsconfig: require.resolve('./tsconfig.test.json'),
}),
require('./plugins/rollup-plugin-inject-code')({
rollupPluginInstrumentTsCode(),
rollupPluginInjectCode({
'index.js': {
line: 3,
code: " if ('adoptedStyleSheets' in document) { return; }\n",
Expand All @@ -180,6 +174,7 @@ module.exports = (config) => {
output: {
format: 'iife',
name: 'source',
sourcemap: 'inline',
},
treeshake: false,
},
Expand Down