Skip to content

Commit

Permalink
Merge pull request #85 from Lodin/chore/fix-workflow
Browse files Browse the repository at this point in the history
Fix CI workflow & send coverage to Codecov
  • Loading branch information
calebdwilliams committed Sep 12, 2021
2 parents ded7a2e + 04cecec commit 34090df
Show file tree
Hide file tree
Showing 8 changed files with 3,735 additions and 5,613 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
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
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

0 comments on commit 34090df

Please sign in to comment.