Setup integration tests (#5466)

* setup integration tests

* fix rgb color syntax

* ensure integration tests always exit

If for any reason the integration tests fail, then it will run forever
on CI (~2hours or something). The `--forceExit` is not ideal but it will
prevent long running processes.

* fix incorrect test

We were never properly waiting for the command to finish.

* handle AbortError properly

In CI, when an AbortController gets aborted an error is thrown
(AbortError). If we don't catch it properly then it will "leak" and the
test will fail.

* improve IO functions

* quit integration tests after 10seconds

* only test a few integrations

* test all integrations using matrix

This will cancel other builds when one fails, it will also separate the
output per integration which can be useful especially now that we are
still figuring things out.

* rename `build` to `test`

* add --verbose flag to receive output in the console

* when reading stdout or stderr, wait a certain about to ensure stability

Debouncing for 200ms means that if another message comes in within those
200ms we delay the execution of the callback.

* simplify workflow

* use terminal output instead of disk events

* cache node_modules for integrations

* empty commit, to test cache hits
This commit is contained in:
Robin Malfait 2021-09-14 16:18:14 +02:00 • committed by GitHub
parent fda1c4403f
commit 516ba530f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 298 additions and 227 deletions

59
.github/workflows/integration-tests.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Integration Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
integration: [parcel, postcss-cli, rollup, tailwindcss-cli, vite, webpack-4, webpack-5]
node-version: [16]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Use cached node_modules (tailwindcss)
id: cache-tailwindcss
uses: actions/cache@v2
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}-tailwindcss
restore-keys: |
nodeModules-
- name: Install dependencies
if: steps.cache-tailwindcss.outputs.cache-hit != 'true'
run: npm install
env:
CI: true
- name: Build Tailwind CSS
run: npm run prepublishOnly
- name: Use cached node_modules (integrations)
id: cache-integrations
uses: actions/cache@v2
with:
path: ./integrations/**/node_modules
key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}-${{ matrix.integration }}-integrations
restore-keys: |
nodeModules-
- name: Install shared dependencies
if: steps.cache-integrations.outputs.cache-hit != 'true'
run: npm run install:integrations
env:
CI: true
- name: Test ${{ matrix.integration }}
run: npm test --prefix ./integrations/${{ matrix.integration }}