Skip to content

Commit

Permalink
update GitHub Actions (#1144)
Browse files Browse the repository at this point in the history
* update GitHub Actions

* fix config file

* defer typescript installation

* add timeout limitation

* force color for mocha

* fix typescript version

* increase timeout limitation

* increase timeout limitation

* fix compatibility issue

* tweak CI

* attempt to fix

* tweak

* tweak and try

* tweak CI

* clean up

* tweak CI

* fix

* revert deletion
  • Loading branch information
g-plane committed Jul 16, 2020
1 parent abae5fd commit 74bf400
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 43 deletions.
19 changes: 0 additions & 19 deletions .github/node-chrome/Dockerfile

This file was deleted.

87 changes: 77 additions & 10 deletions .github/workflows/push.yml
@@ -1,29 +1,96 @@
on: [push, pull_request]
name: CI

name: build and test
on: [push, pull_request]

jobs:
build_and_test:
comparison_test:
name: Comparison Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: install
run: yarn install

- name: build
run: yarn build

- name: install typescript
run: yarn add typescript@3.9.3

- name: test
run: sudo yarn comparison-tests

windows:
name: Windows Test
runs-on: windows-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v2

- name: copy files
shell: pwsh
run: |
New-Item C:\source\ts-loader -ItemType Directory
Copy-Item .\* C:\source\ts-loader -Recurse -Force
- name: install
run: yarn install
working-directory: C:\source\ts-loader

- name: build
run: yarn build
working-directory: C:\source\ts-loader

- name: install typescript
run: yarn add typescript@3.9.3
working-directory: C:\source\ts-loader

- name: test
run: yarn comparison-tests
working-directory: C:\source\ts-loader

execution_test:
name: Execution Test
strategy:
matrix:
os: [ubuntu]
node: [10, 12, 14]
ts: [3.6.5, 3.7.5, 3.8.3, 3.9.3, next]
include:
- os: windows
node: 14
ts: 3.9.3
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2

- name: install node
uses: actions/setup-node@v1
with:
node-version: 12

- name: upgrade yarn
run: npm install yarn -g
node-version: ${{ matrix.node }}

- name: install
run: yarn install

- name: build
run: yarn build

- name: install chrome
uses: ./.github/node-chrome
- name: install typescript
run: yarn add typescript@${{ matrix.ts }}

- name: test
run: yarn execution-tests

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: install
run: yarn install

- name: lint
run: yarn lint
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -19,4 +19,3 @@ env:
- TYPESCRIPT=typescript@3.8.2
- TYPESCRIPT=typescript@3.7.4
- TYPESCRIPT=typescript@3.6.3

2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -8,7 +8,7 @@ environment:
- TYPESCRIPT: typescript@3.8.2
- TYPESCRIPT: typescript@3.7.4
- TYPESCRIPT: typescript@3.6.3

install:
- ps: Install-Product node $env:nodejs_version
- yarn install
Expand Down
22 changes: 11 additions & 11 deletions test/comparison-tests/create-and-execute-test.js
Expand Up @@ -68,9 +68,9 @@ if (fs.statSync(testPath).isDirectory() &&

/**
* Create a Jasmine test
* @param {string} test
* @param {string} testPath
* @param {any} options
* @param {string} test
* @param {string} testPath
* @param {any} options
*/
function createTest(test, testPath, options) {
return function (done) {
Expand Down Expand Up @@ -177,7 +177,7 @@ function createWebpackConfig(paths, optionsOriginal, useWatchApi) {

const tsLoaderPath = path.join(__dirname, "../../index.js");
aliasLoader(config, tsLoaderPath, options);

config.context = paths.outputPath;
paths.outputPath = config.output.path = config.output.path || paths.outputPath;
config.resolveLoader = config.resolveLoader || {};
Expand Down Expand Up @@ -401,11 +401,11 @@ 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|workspace)\/\.test/ig, '')
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/')
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/')
.replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/')
.replace(/([a-zA-Z]\:\/)?[\w|\/]*\/(ts-(loader)?|workspace)\/\.test/ig, '')
.replace(/webpack:\/\/([a-zA-Z]:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/')
.replace(/WEBPACK FOOTER\/n\/ ([a-zA-Z]:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
.replace(/!\** ([a-zA-Z]\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/')
.replace(/\/ ([a-zA-Z]\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/')
// with webpack 4 there are different numbers of *s on Windows and on Linux
.replace(/\*{10}\**/g, '**********');
} catch (e) {
Expand All @@ -425,9 +425,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|workspace)[\/|\\]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|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
.replace(/\(\S+[\/|\\](ts-(loader)?|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/comparison-tests/run-tests.js
Expand Up @@ -182,7 +182,7 @@ function runTestAsChildProcess(testName) {
const testToRun = ' --test-to-run ' + testName;
const debug = process.argv.indexOf('--debug') > -1;
const testCommand =
'mocha --reporter spec ' +
'mocha -c --reporter spec ' +
(debug ? '--inspect-brk=5858 ' : '') +
'test/comparison-tests/create-and-execute-test.js ' +
testToRun;
Expand Down

0 comments on commit 74bf400

Please sign in to comment.