From 8449699202c280646c47cf0a45274ca023e05b5f Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Mon, 21 Sep 2020 02:44:22 -0400 Subject: [PATCH] feat: add test matrix to all templates' CI - 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 --- templates/basic/.github/workflows/main.yml | 14 ++++++++++---- templates/basic/README.md | 2 +- .../.github/workflows/main.yml | 14 ++++++++++---- templates/react-with-storybook/README.md | 2 +- templates/react/.github/workflows/main.yml | 14 ++++++++++---- templates/react/README.md | 4 ++-- 6 files changed, 34 insertions(+), 16 deletions(-) diff --git a/templates/basic/.github/workflows/main.yml b/templates/basic/.github/workflows/main.yml index 182554c6a..535e4b7c9 100644 --- a/templates/basic/.github/workflows/main.yml +++ b/templates/basic/.github/workflows/main.yml @@ -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 diff --git a/templates/basic/README.md b/templates/basic/README.md index 0e115bfd2..93eb55df4 100644 --- a/templates/basic/README.md +++ b/templates/basic/README.md @@ -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 diff --git a/templates/react-with-storybook/.github/workflows/main.yml b/templates/react-with-storybook/.github/workflows/main.yml index 182554c6a..535e4b7c9 100644 --- a/templates/react-with-storybook/.github/workflows/main.yml +++ b/templates/react-with-storybook/.github/workflows/main.yml @@ -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 diff --git a/templates/react-with-storybook/README.md b/templates/react-with-storybook/README.md index f5e0dd69a..134273f32 100644 --- a/templates/react-with-storybook/README.md +++ b/templates/react-with-storybook/README.md @@ -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 diff --git a/templates/react/.github/workflows/main.yml b/templates/react/.github/workflows/main.yml index 182554c6a..535e4b7c9 100644 --- a/templates/react/.github/workflows/main.yml +++ b/templates/react/.github/workflows/main.yml @@ -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 diff --git a/templates/react/README.md b/templates/react/README.md index 1f020dd28..1db53ccd9 100644 --- a/templates/react/README.md +++ b/templates/react/README.md @@ -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