Skip to content

Commit

Permalink
feat: add test matrix to all templates' CI
Browse files Browse the repository at this point in the history
- have been using this internally for about a year now, so should be
  good to use by general users too
  - the original proposal to add Actions to all templates also suggested
    adding matrix testing, but that didn't make it into the original PR

- support Node 10, 12, and 14, as well as ubuntu, macOS, and windows
  latest
  - add a note in the docs mentioning the test matrix
    - also fix one doc's missing `size-limit` link
      - not sure how that got missed

- add clear names to all jobs and steps as well
  - change some to include the matrix variant that is currently running
  - "Begin CI..." was not really clear, use "Checkout repo" instead
  • Loading branch information
agilgur5 committed Sep 21, 2020
1 parent f109fe9 commit 8449699
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
14 changes: 10 additions & 4 deletions templates/basic/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['10.x', '12.x', '14.x']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Begin CI...
- name: Checkout repo
uses: actions/checkout@v2

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

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
Expand Down
2 changes: 1 addition & 1 deletion templates/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rol

Two actions are added by default:

- `main` which installs deps w/ cache, lints, tests, and builds on all pushes
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)

## Optimizations
Expand Down
14 changes: 10 additions & 4 deletions templates/react-with-storybook/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['10.x', '12.x', '14.x']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Begin CI...
- name: Checkout repo
uses: actions/checkout@v2

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

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
Expand Down
2 changes: 1 addition & 1 deletion templates/react-with-storybook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rol

Two actions are added by default:

- `main` which runs installs deps w/ cache, lints, tests, and builds on all pushes
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
- `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)

## Optimizations
Expand Down
14 changes: 10 additions & 4 deletions templates/react/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['10.x', '12.x', '14.x']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Begin CI...
- name: Checkout repo
uses: actions/checkout@v2

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

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
Expand Down
4 changes: 2 additions & 2 deletions templates/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rol

Two actions are added by default:

- `main` which runs installs deps w/ cache, lints, tests, and builds on all pushes
- `size` which comments cost comparison of your library on every pull request using
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)

## Optimizations

Expand Down

0 comments on commit 8449699

Please sign in to comment.