Skip to content

Commit

Permalink
release event not available so use push event and filter (#893)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
johnnyreilly committed Jan 8, 2019
1 parent 177a985 commit df04a56
Show file tree
Hide file tree
Showing 32 changed files with 390 additions and 918 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.github
.vscode
.test
node_modules
examples
26 changes: 17 additions & 9 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
workflow "build, test and publish on release" {
on = "release"
resolves = "publish"
on = "push"
# resolves = "publish" - commented until this issue is resolved: https://github.com/actions/bin/issues/13
resolves = "check for new tag"
}

# install with yarn
Expand All @@ -21,15 +22,22 @@ action "build" {
# test with yarn
action "test" {
needs = "build"
uses = "actions/npm@1.0.0"
uses = "./.github/node-chrome"
runs = "yarn"
args = "test"
args = "execution-tests"
}

# publish with npm
action "publish" {
# filter for a new tag
action "check for new tag" {
needs = "test"
uses = "actions/npm@1.0.0"
args = "publish"
secrets = ["NPM_AUTH_TOKEN"]
uses = "actions/bin/filter@master"
args = "tag"
}

# publish with npm - commented until this issue is resolved: https://github.com/actions/bin/issues/13
#action "publish" {
# needs = "check for new tag"
# uses = "actions/npm@1.0.0"
# args = "publish"
# secrets = ["NPM_AUTH_TOKEN"]
#}
19 changes: 19 additions & 0 deletions .github/node-chrome/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Taken from https://raw.githubusercontent.com/filipesilva/ng-github-actions/master/.github/node-chrome/Dockerfile
# and https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
FROM node:10

# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ addons:
chrome: stable
language: node_js
node_js:
- "6"
- "8"
- "10"
sudo: required
Expand Down
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM node:10

# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb

WORKDIR /TypeStrong/ts-loader

# install packages
COPY package.json yarn.lock index.js /TypeStrong/ts-loader/
RUN yarn

# build
COPY src /TypeStrong/ts-loader/src
RUN yarn build

# test
COPY test /TypeStrong/ts-loader/test

# build and run tests with:
# docker build -t ts-loader .
# docker run -it ts-loader yarn test
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"lint": "tslint --project \"./src\"",
"comparison-tests": "tsc --project \"./test/comparison-tests\" && npm link ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
"comparison-tests-generate": "node test/comparison-tests/stub-new-version.js",
"execution-tests": "npm i -g pnpm && node test/execution-tests/run-tests.js",
"test": "node test/run-tests.js"
"execution-tests": "node test/execution-tests/run-tests.js",
"test": "node test/run-tests.js",
"docker:build": "docker build -t ts-loader .",
"postdocker:build": "docker run -it ts-loader yarn test"
},
"husky": {
"hooks": {
Expand Down
6 changes: 3 additions & 3 deletions test/comparison-tests/create-and-execute-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function getNormalisedFileContent(file, location) {
return 'at ' + remainingPathAndColon + 'irrelevant-line-number' + colon + 'irrelevant-column-number';
})
// strip C:/projects/ts-loader/.test/
.replace(/(C\:\/)?[\w|\/]*\/ts-loader\/\.test/g, '')
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/g, '')
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'webpack://comparison-tests/')
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '!*** /ts-loader/test/comparison-tests/')
Expand All @@ -440,9 +440,9 @@ function normaliseString(platformSpecificContent) {
.replace(new RegExp(regexEscape('\\'), 'g'), '/')
.replace(new RegExp(regexEscape('//'), 'g'), '/')
// replace C:/source/ts-loader/index.js or /home/travis/build/TypeStrong/ts-loader/index.js with ts-loader
.replace(/ \S+[\/|\\]ts-loader[\/|\\]index.js/g, 'ts-loader')
.replace(/ \S+[\/|\\](ts-loader|workspace)[\/|\\]index.js/g, 'ts-loader')
// replace (C:/source/ts-loader/dist/index.js with (ts-loader)
.replace(/\(\S+[\/|\\]ts-loader[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
.replace(/\(\S+[\/|\\](ts-loader|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
}

/**
Expand Down
49 changes: 8 additions & 41 deletions test/execution-tests/1.8.2_allowJs-entryFileIsJs/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
/* eslint-disable no-var, strict */
'use strict';
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
var reporterOptions = require('../../reporterOptions');
var makeKarmaConfig = require('../../karmaConfig');

module.exports = function(config) {
config.set({
browsers: [ 'ChromeHeadless' ],

files: [
// This loads all the tests
'./**/*.tests.js'
],

port: 9876,

frameworks: [ 'jasmine' ],

logLevel: config.LOG_INFO, //config.LOG_DEBUG

preprocessors: {
'./**/*.js': [ 'webpack', 'sourcemap' ]
},

webpack: {
devtool: 'inline-source-map',
mode: webpackConfig.mode,
module: webpackConfig.module,
resolve: webpackConfig.resolve,

// for test harness purposes only, you would not need this in a normal project
resolveLoader: webpackConfig.resolveLoader
},

webpackMiddleware: {
quiet: true,
stats: {
colors: true
}
},

// reporter options
mochaReporter: reporterOptions,
});
config.set(
makeKarmaConfig({
config,
webpackConfig,
files: ['./**/*.tests.js']
})
);
};
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
/* eslint-disable no-var, strict */
'use strict';
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
var reporterOptions = require('../../reporterOptions');
var makeKarmaConfig = require('../../karmaConfig');

module.exports = function(config) {
config.set({
browsers: [ 'ChromeHeadless' ],

files: [
// This ensures we have the es6 shims in place from babel and then loads all the tests
'main.js'
],

port: 9876,

frameworks: [ 'jasmine' ],

logLevel: config.LOG_INFO, //config.LOG_DEBUG

preprocessors: {
'main.js': [ 'webpack', 'sourcemap' ]
},

webpack: {
devtool: 'inline-source-map',
mode: webpackConfig.mode,
module: webpackConfig.module,
resolve: webpackConfig.resolve,

// for test harness purposes only, you would not need this in a normal project
resolveLoader: webpackConfig.resolveLoader
},

webpackMiddleware: {
quiet: true,
stats: {
colors: true
}
},

// reporter options
mochaReporter: reporterOptions,
});
config.set(
makeKarmaConfig({
config,
webpackConfig,
files: [
// This ensures we have the es6 shims in place from babel and then loads all the tests
'main.js'
]
})
);
};
52 changes: 11 additions & 41 deletions test/execution-tests/2.0.3_typesResolution/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
/* eslint-disable no-var, strict */
'use strict';
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
var reporterOptions = require('../../reporterOptions');
var makeKarmaConfig = require('../../karmaConfig');

module.exports = function(config) {
config.set({
browsers: [ 'ChromeHeadless' ],

files: [
// This loads all the tests
'main.js'
],

port: 9876,

frameworks: [ 'jasmine' ],

logLevel: config.LOG_INFO, //config.LOG_DEBUG

preprocessors: {
'main.js': [ 'webpack', 'sourcemap' ]
},

webpack: {
devtool: 'inline-source-map',
mode: webpackConfig.mode,
module: webpackConfig.module,
resolve: webpackConfig.resolve,

// for test harness purposes only, you would not need this in a normal project
resolveLoader: webpackConfig.resolveLoader
},

webpackMiddleware: {
quiet: true,
stats: {
colors: true
}
},

// reporter options
mochaReporter: reporterOptions
});
config.set(
makeKarmaConfig({
config,
webpackConfig,
files: [
// This ensures we have the es6 shims in place from babel and then loads all the tests
'main.js'
]
})
);
};
51 changes: 11 additions & 40 deletions test/execution-tests/2.1.4_babel-allowJsImportTypes/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
/* eslint-disable no-var, strict */
'use strict';
var webpackConfig = require('./webpack.config.js');
var reporterOptions = require('../../reporterOptions');
var makeKarmaConfig = require('../../karmaConfig');

module.exports = function(config) {
// Documentation: https://karma-runner.github.io/0.13/config/configuration-file.html
config.set({
browsers: [ 'ChromeHeadless' ],

files: [
// This ensures we have the es6 shims in place and then loads all the tests
'main.js'
],

port: 9876,

frameworks: [ 'jasmine' ],

logLevel: config.LOG_INFO, //config.LOG_DEBUG

preprocessors: {
'main.js': [ 'webpack', 'sourcemap' ]
},

webpack: {
devtool: 'inline-source-map',
mode: webpackConfig.mode,
module: webpackConfig.module,
resolve: webpackConfig.resolve,

// for test harness purposes only, you would not need this in a normal project
resolveLoader: webpackConfig.resolveLoader
},

webpackMiddleware: {
quiet: true,
stats: {
colors: true
}
},

// reporter options
mochaReporter: reporterOptions
});
config.set(
makeKarmaConfig({
config,
webpackConfig,
files: [
// This ensures we have the es6 shims in place from babel and then loads all the tests
'main.js'
]
})
);
};
Loading

0 comments on commit df04a56

Please sign in to comment.