Skip to content

Commit

Permalink
Modernize scaffold (#25)
Browse files Browse the repository at this point in the history
* Modernize scaffold

* Add PR template

* Fix tests

* Fix tests

* Update README.md

* Bump deps

* Update read-pkg-up usage

* Fix tests

* Fix tests

* Rename webpack tests

* Disable PR trigger

* Move tests

* Fix npm-alias test

* Update entry

* Clean up
  • Loading branch information
compulim committed Feb 28, 2022
1 parent 2b6c40f commit 5943a70
Show file tree
Hide file tree
Showing 51 changed files with 9,713 additions and 3,863 deletions.
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Summary

<!-- Explain the purpose of this pull request in one line. -->

## Changelog

### Fixed/Added/Changed

<!-- Copy and paste the entry from CHANGELOG.md. -->

## Design considerations

<!-- Explains how we come up with the final design and design candidates (if any). -->

## Specific changes

<!-- Explains what changed in details. -->

-

## Reminders

<!-- Checks all boxes even if it is irrelevant to this pull request. -->

- [ ] I have updated `CHANGELOG.md`
- [ ] I have added tests for new code
- [ ] I have updated documentations
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: continuous deployment

on:
push:
Expand All @@ -11,11 +11,6 @@ on:
tags:
- '*'

pull_request:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -51,12 +46,6 @@ jobs:
cp dist/* public
cd public
- uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '16.x' }}
with:
name: e2e-tests
path: '__e2e__/**/*'

- uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '16.x' }}
with:
Expand All @@ -69,83 +58,11 @@ jobs:
name: npm-tarball
path: '*.tgz'

test-linux:
needs: build
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# NPM@7 is buggy right now, we will use NPM@6 until Node.js 16.x go LTS.
- name: Use NPM@6 on Node.js 16.x
if: ${{ matrix.node-version == '16.x' }}
run: npm i -g npm@6 --registry=https://registry.npmjs.org

- uses: actions/download-artifact@v2
with:
name: e2e-tests

- uses: actions/download-artifact@v2
with:
name: npm-tarball

- name: Install dependencies
run: |
mv *.tgz package.tgz
npm install
- name: Run tests
run: npm test

test-windows:
needs: build
runs-on: windows-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# NPM@7 is buggy right now, we will use NPM@6 until Node.js 16.x go LTS.
- name: Use NPM@6 on Node.js 16.x
if: ${{ matrix.node-version == '16.x' }}
run: npm i -g npm@6 --registry=https://registry.npmjs.org

- uses: actions/download-artifact@v2
with:
name: e2e-tests

- uses: actions/download-artifact@v2
with:
name: npm-tarball

- name: Install dependencies
run: |
ren *.tgz package.tgz
npm install
- name: Run tests
run: npm test

publish-pages:
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}

needs:
- build
- test-linux
- test-windows

runs-on: ubuntu-latest

Expand All @@ -165,8 +82,6 @@ jobs:

needs:
- build
- test-linux
- test-windows

runs-on: ubuntu-latest

Expand Down
98 changes: 0 additions & 98 deletions .github/workflows/e2e-test.yml

This file was deleted.

98 changes: 98 additions & 0 deletions .github/workflows/pull-request-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: pull request validation

on:
pull_request:

workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
default: 'main'

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['12', '14', '16']
npm-version: [default, latest]

steps:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install latest NPM
if: ${{ matrix.npm-version == 'latest' }}
run: npm install -g npm

- run: |
npm ci
npm run prepublishOnly
rm -r lib
npm pack
- name: Upload end-to-end tests
uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '16' && matrix.npm-version == 'default' }}
with:
name: e2e-tests
path: 'tests/e2e/**/*'

- name: Upload package tarball
uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '16' && matrix.npm-version == 'default' }}
with:
name: package
path: '*.tgz'

test:
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
resolver:
- esbuild
- node-commonjs
- node-esm
- node-global
- npm-alias
- rollup
- webpack@4-commonjs
- webpack@4-esm
- webpack@5-commonjs
- webpack@5-esm
node-version: ['12', '14', '16']
npm-version: [default, latest]

steps:
- name: Download end-to-end tests
uses: actions/download-artifact@v2
with:
name: e2e-tests

- name: Download package tarball
uses: actions/download-artifact@v2
with:
name: package

- name: Build test image
run: |
cd ${{ matrix.resolver }}
cp ../*.tgz .
ls -la
docker build --build-arg NODE_VERSION=${{ matrix.node-version }} --build-arg NPM_VERSION=${{ matrix.npm-version }} --file Dockerfile --tag test-image .
- name: Run test
run: |
cd ${{ matrix.resolver }}
docker run --name test-container test-image > actual.txt
diff expected.txt actual.txt
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Updated end-to-end tests, by [@compulim](https://github.com/compulim), in PR [#25](https://github.com/compulim/abort-controller-es5/pull/25)
- Using Docker to isolate tests
- Test against different combinations of Node.js, NPM, and resolvers
- Bumped dependencies, by [@compulim](https://github.com/compulim), in PR [#25](https://github.com/compulim/abort-controller-es5/pull/25)
- [`@babel/cli@7.17.6`](https://npmjs.com/package/@babel/cli)
- [`@babel/core@7.17.5`](https://npmjs.com/package/@babel/core)
- [`@babel/plugin-transform-runtime@7.17.0`](https://npmjs.com/package/@babel/plugin-transform-runtime)
- [`@babel/preset-env@7.16.11`](https://npmjs.com/package/@babel/preset-env)
- [`@babel/runtime-corejs3@7.17.2`](https://npmjs.com/package/@babel/runtime-corejs3)
- [`esbuild@0.14.23`](https://npmjs.com/package/esbuild)
- [`read-pkg-up@9.1.0`](https://npmjs.com/package/read-pkg-up)
- [`jest@27.5.1`](https://npmjs.com/package/jest)

## [2.0.0] - 2021-07-20

### Changed
Expand Down

0 comments on commit 5943a70

Please sign in to comment.