Skip to content

Commit df04a56

Browse files
authored
release event not available so use push event and filter (#893)
* release event not available so use push event and filter * use @master in place of @1.0.0 * check for a new tag last * Try using docker://zenika/alpine-chrome:with-node Need chrome to run tests * Can use yarn * Just run execution tests * Use node 10 docker image and run all tests * Comment tests until they are dockerised * Run execution tests again * Don't install pnpm globally * Use npx to run pnpm * Run Chrome no sandbox * More --no-sandbox * create own dockerfile with node / chrome headless * common karma.conf.js using ChromeHeadless --no-sandbox * no sandbox on command line * use alpine-chrome:with-node docker image * back to the version that works * drop node 6 from travis * try using node:10-slim * start building and running in docker * use full node image instead of slim for comparison tests * set GITHUB_WORKSPACE = "/github/workspace/ts-loader" * close to being able to run comparison tests in docker container * left a stray * tests pass in docker * can comparison tests pass in a GitHub Action? * comparison tests will not pass in github action * add docker:build step to package.json * Exclude npm publishing until https://github.com/actions/bin/issues/13 is fixed * Update main.workflow
1 parent 177a985 commit df04a56

File tree

32 files changed

+390
-918
lines changed

32 files changed

+390
-918
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.github
3+
.vscode
4+
.test
5+
node_modules
6+
examples

.github/main.workflow

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
workflow "build, test and publish on release" {
2-
on = "release"
3-
resolves = "publish"
2+
on = "push"
3+
# resolves = "publish" - commented until this issue is resolved: https://github.com/actions/bin/issues/13
4+
resolves = "check for new tag"
45
}
56

67
# install with yarn
@@ -21,15 +22,22 @@ action "build" {
2122
# test with yarn
2223
action "test" {
2324
needs = "build"
24-
uses = "actions/npm@1.0.0"
25+
uses = "./.github/node-chrome"
2526
runs = "yarn"
26-
args = "test"
27+
args = "execution-tests"
2728
}
2829

29-
# publish with npm
30-
action "publish" {
30+
# filter for a new tag
31+
action "check for new tag" {
3132
needs = "test"
32-
uses = "actions/npm@1.0.0"
33-
args = "publish"
34-
secrets = ["NPM_AUTH_TOKEN"]
33+
uses = "actions/bin/filter@master"
34+
args = "tag"
3535
}
36+
37+
# publish with npm - commented until this issue is resolved: https://github.com/actions/bin/issues/13
38+
#action "publish" {
39+
# needs = "check for new tag"
40+
# uses = "actions/npm@1.0.0"
41+
# args = "publish"
42+
# secrets = ["NPM_AUTH_TOKEN"]
43+
#}

.github/node-chrome/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Taken from https://raw.githubusercontent.com/filipesilva/ng-github-actions/master/.github/node-chrome/Dockerfile
2+
# and https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
3+
FROM node:10
4+
5+
# See https://crbug.com/795759
6+
RUN apt-get update && apt-get install -yq libgconf-2-4
7+
8+
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
9+
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
10+
# installs, work.
11+
RUN apt-get update && apt-get install -y wget --no-install-recommends \
12+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
13+
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
14+
&& apt-get update \
15+
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
16+
--no-install-recommends \
17+
&& rm -rf /var/lib/apt/lists/* \
18+
&& apt-get purge --auto-remove -y curl \
19+
&& rm -rf /src/*.deb

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ addons:
44
chrome: stable
55
language: node_js
66
node_js:
7-
- "6"
87
- "8"
98
- "10"
109
sudo: required

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM node:10
2+
3+
# See https://crbug.com/795759
4+
RUN apt-get update && apt-get install -yq libgconf-2-4
5+
6+
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
7+
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
8+
# installs, work.
9+
RUN apt-get update && apt-get install -y wget --no-install-recommends \
10+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
11+
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
12+
&& apt-get update \
13+
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
14+
--no-install-recommends \
15+
&& rm -rf /var/lib/apt/lists/* \
16+
&& apt-get purge --auto-remove -y curl \
17+
&& rm -rf /src/*.deb
18+
19+
WORKDIR /TypeStrong/ts-loader
20+
21+
# install packages
22+
COPY package.json yarn.lock index.js /TypeStrong/ts-loader/
23+
RUN yarn
24+
25+
# build
26+
COPY src /TypeStrong/ts-loader/src
27+
RUN yarn build
28+
29+
# test
30+
COPY test /TypeStrong/ts-loader/test
31+
32+
# build and run tests with:
33+
# docker build -t ts-loader .
34+
# docker run -it ts-loader yarn test

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"lint": "tslint --project \"./src\"",
1010
"comparison-tests": "tsc --project \"./test/comparison-tests\" && npm link ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
1111
"comparison-tests-generate": "node test/comparison-tests/stub-new-version.js",
12-
"execution-tests": "npm i -g pnpm && node test/execution-tests/run-tests.js",
13-
"test": "node test/run-tests.js"
12+
"execution-tests": "node test/execution-tests/run-tests.js",
13+
"test": "node test/run-tests.js",
14+
"docker:build": "docker build -t ts-loader .",
15+
"postdocker:build": "docker run -it ts-loader yarn test"
1416
},
1517
"husky": {
1618
"hooks": {

test/comparison-tests/create-and-execute-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ function getNormalisedFileContent(file, location) {
416416
return 'at ' + remainingPathAndColon + 'irrelevant-line-number' + colon + 'irrelevant-column-number';
417417
})
418418
// strip C:/projects/ts-loader/.test/
419-
.replace(/(C\:\/)?[\w|\/]*\/ts-loader\/\.test/g, '')
419+
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/g, '')
420420
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'webpack://comparison-tests/')
421421
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
422422
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '!*** /ts-loader/test/comparison-tests/')
@@ -440,9 +440,9 @@ function normaliseString(platformSpecificContent) {
440440
.replace(new RegExp(regexEscape('\\'), 'g'), '/')
441441
.replace(new RegExp(regexEscape('//'), 'g'), '/')
442442
// replace C:/source/ts-loader/index.js or /home/travis/build/TypeStrong/ts-loader/index.js with ts-loader
443-
.replace(/ \S+[\/|\\]ts-loader[\/|\\]index.js/g, 'ts-loader')
443+
.replace(/ \S+[\/|\\](ts-loader|workspace)[\/|\\]index.js/g, 'ts-loader')
444444
// replace (C:/source/ts-loader/dist/index.js with (ts-loader)
445-
.replace(/\(\S+[\/|\\]ts-loader[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
445+
.replace(/\(\S+[\/|\\](ts-loader|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
446446
}
447447

448448
/**
Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,14 @@
11
/* eslint-disable no-var, strict */
22
'use strict';
3-
var path = require('path');
4-
var webpack = require('webpack');
53
var webpackConfig = require('./webpack.config.js');
6-
var reporterOptions = require('../../reporterOptions');
4+
var makeKarmaConfig = require('../../karmaConfig');
75

86
module.exports = function(config) {
9-
config.set({
10-
browsers: [ 'ChromeHeadless' ],
11-
12-
files: [
13-
// This loads all the tests
14-
'./**/*.tests.js'
15-
],
16-
17-
port: 9876,
18-
19-
frameworks: [ 'jasmine' ],
20-
21-
logLevel: config.LOG_INFO, //config.LOG_DEBUG
22-
23-
preprocessors: {
24-
'./**/*.js': [ 'webpack', 'sourcemap' ]
25-
},
26-
27-
webpack: {
28-
devtool: 'inline-source-map',
29-
mode: webpackConfig.mode,
30-
module: webpackConfig.module,
31-
resolve: webpackConfig.resolve,
32-
33-
// for test harness purposes only, you would not need this in a normal project
34-
resolveLoader: webpackConfig.resolveLoader
35-
},
36-
37-
webpackMiddleware: {
38-
quiet: true,
39-
stats: {
40-
colors: true
41-
}
42-
},
43-
44-
// reporter options
45-
mochaReporter: reporterOptions,
46-
});
7+
config.set(
8+
makeKarmaConfig({
9+
config,
10+
webpackConfig,
11+
files: ['./**/*.tests.js']
12+
})
13+
);
4714
};
Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,17 @@
11
/* eslint-disable no-var, strict */
22
'use strict';
3-
var path = require('path');
4-
var webpack = require('webpack');
53
var webpackConfig = require('./webpack.config.js');
6-
var reporterOptions = require('../../reporterOptions');
4+
var makeKarmaConfig = require('../../karmaConfig');
75

86
module.exports = function(config) {
9-
config.set({
10-
browsers: [ 'ChromeHeadless' ],
11-
12-
files: [
13-
// This ensures we have the es6 shims in place from babel and then loads all the tests
14-
'main.js'
15-
],
16-
17-
port: 9876,
18-
19-
frameworks: [ 'jasmine' ],
20-
21-
logLevel: config.LOG_INFO, //config.LOG_DEBUG
22-
23-
preprocessors: {
24-
'main.js': [ 'webpack', 'sourcemap' ]
25-
},
26-
27-
webpack: {
28-
devtool: 'inline-source-map',
29-
mode: webpackConfig.mode,
30-
module: webpackConfig.module,
31-
resolve: webpackConfig.resolve,
32-
33-
// for test harness purposes only, you would not need this in a normal project
34-
resolveLoader: webpackConfig.resolveLoader
35-
},
36-
37-
webpackMiddleware: {
38-
quiet: true,
39-
stats: {
40-
colors: true
41-
}
42-
},
43-
44-
// reporter options
45-
mochaReporter: reporterOptions,
46-
});
7+
config.set(
8+
makeKarmaConfig({
9+
config,
10+
webpackConfig,
11+
files: [
12+
// This ensures we have the es6 shims in place from babel and then loads all the tests
13+
'main.js'
14+
]
15+
})
16+
);
4717
};
Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,17 @@
11
/* eslint-disable no-var, strict */
22
'use strict';
3-
var path = require('path');
4-
var webpack = require('webpack');
53
var webpackConfig = require('./webpack.config.js');
6-
var reporterOptions = require('../../reporterOptions');
4+
var makeKarmaConfig = require('../../karmaConfig');
75

86
module.exports = function(config) {
9-
config.set({
10-
browsers: [ 'ChromeHeadless' ],
11-
12-
files: [
13-
// This loads all the tests
14-
'main.js'
15-
],
16-
17-
port: 9876,
18-
19-
frameworks: [ 'jasmine' ],
20-
21-
logLevel: config.LOG_INFO, //config.LOG_DEBUG
22-
23-
preprocessors: {
24-
'main.js': [ 'webpack', 'sourcemap' ]
25-
},
26-
27-
webpack: {
28-
devtool: 'inline-source-map',
29-
mode: webpackConfig.mode,
30-
module: webpackConfig.module,
31-
resolve: webpackConfig.resolve,
32-
33-
// for test harness purposes only, you would not need this in a normal project
34-
resolveLoader: webpackConfig.resolveLoader
35-
},
36-
37-
webpackMiddleware: {
38-
quiet: true,
39-
stats: {
40-
colors: true
41-
}
42-
},
43-
44-
// reporter options
45-
mochaReporter: reporterOptions
46-
});
7+
config.set(
8+
makeKarmaConfig({
9+
config,
10+
webpackConfig,
11+
files: [
12+
// This ensures we have the es6 shims in place from babel and then loads all the tests
13+
'main.js'
14+
]
15+
})
16+
);
4717
};
Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
11
/* eslint-disable no-var, strict */
22
'use strict';
33
var webpackConfig = require('./webpack.config.js');
4-
var reporterOptions = require('../../reporterOptions');
4+
var makeKarmaConfig = require('../../karmaConfig');
55

66
module.exports = function(config) {
7-
// Documentation: https://karma-runner.github.io/0.13/config/configuration-file.html
8-
config.set({
9-
browsers: [ 'ChromeHeadless' ],
10-
11-
files: [
12-
// This ensures we have the es6 shims in place and then loads all the tests
13-
'main.js'
14-
],
15-
16-
port: 9876,
17-
18-
frameworks: [ 'jasmine' ],
19-
20-
logLevel: config.LOG_INFO, //config.LOG_DEBUG
21-
22-
preprocessors: {
23-
'main.js': [ 'webpack', 'sourcemap' ]
24-
},
25-
26-
webpack: {
27-
devtool: 'inline-source-map',
28-
mode: webpackConfig.mode,
29-
module: webpackConfig.module,
30-
resolve: webpackConfig.resolve,
31-
32-
// for test harness purposes only, you would not need this in a normal project
33-
resolveLoader: webpackConfig.resolveLoader
34-
},
35-
36-
webpackMiddleware: {
37-
quiet: true,
38-
stats: {
39-
colors: true
40-
}
41-
},
42-
43-
// reporter options
44-
mochaReporter: reporterOptions
45-
});
7+
config.set(
8+
makeKarmaConfig({
9+
config,
10+
webpackConfig,
11+
files: [
12+
// This ensures we have the es6 shims in place from babel and then loads all the tests
13+
'main.js'
14+
]
15+
})
16+
);
4617
};

0 commit comments

Comments
 (0)