Skip to content

Commit

Permalink
Separate stable and oxide engines (tailwindlabs#10359)
Browse files Browse the repository at this point in the history
* separate `stable` and `oxide` mode (package.json in this case)

* drop `install` script (we use a workspace now)

* change required engine to 16

* enable OXIDE by default

* ignore generated `oxide` files

* splitup package.json scripts into "public" and "private" scripts

Not ideal of course, but this should make it a tiny bit easier to know
which scripts _you_ as a developer / contributor have to run.

* drop `workspaces` from the `stable` engine

* drop `oxide` related build files from the `stable` engine

* drop `oxide` engine specific dependencies from the `stable` engine

* use the `oxide-node-api-shim` for the `stable` engine

* add little script to swap the engines

* drop `oxide:build` from `turbo` config

* configure `ci` for `stable` and `oxide` engines

- rename `nodejs.yml` -> `ci.yml`
- add `ci-stable.yml` (for stable mode and Node 12)
- ensure to use the `stable` engine in the `ci-stable.yml` workflow
- drop `oxide:___` specific scripts

* rename `release-insiders` to `release-insiders-stable`

This way we will be able to remove all files that contain `stable` once
we are ready.

* rename `release-insiders-oxide` to just `release-insiders`

* cleanup insider related workflows

* rename `release` -> `release-stable`

* rename `release-oxide` -> `release`

* change names of release workflows

* drop `oxide-` prefix from jobs

* inline node versions

* do not use `turbo` for the stable build

Can't use it because we don't have a workspace in the stable build.

* re-rename CI workflow

* encode default engine in relevant `package.json` files

* make Node 12 work

* increase `node-version` matrix

* make release workflows explicit (per engine)

* add `Oxide` to workflow name

* add integration tests for the `oxide` engine

* add integration tests for the `stable` engine

* run `oxide` integrations against node `18`

* run `stable` integration tests against node 18

We should test node 12 for tailwindcss, but integrations itself can run
against a newer version. In fact, we always ran them against node 16.

* use `localhost` instead of `0.0.0.0`

* ensure `webpack-4` works on Node 18

* run relese scripst directly

Instead of going via `npm`. It's a bit nicer and quicker!

* drop unused scripts

* sync package-lock.json

* ensure to generate the plugin list before running `jest`

We _could_ use an `npm run pretest`, but then you can't run `jest`
directly anymore (which is required for some tools like vscode
extensions).

* cleanup npm scripts

* drop pretend comments

* fix typo

* add `build:rust` as a pre-jest run script
  • Loading branch information
RobinMalfait authored Jan 19, 2023
1 parent 07fe8bf commit b1f4da7
Show file tree
Hide file tree
Showing 30 changed files with 13,650 additions and 351 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/tests/fixtures/cli-utils.js
/stubs/*
/src/corePluginList.js
/oxide/crates/node/index.js
/oxide/crates/node/index.d.ts
56 changes: 56 additions & 0 deletions .github/workflows/ci-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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: CI — Stable

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: stable

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12, 18]

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

- name: Use the `stable` engine
run: |
node ./scripts/swap-engines.js
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm install

- name: Build Tailwind CSS
run: npm run build

- name: Test
run: npm run test

- name: Lint
run: npm run style
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI — Oxide

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: oxide

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18]

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

- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}

# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('./oxide/**/Cargo.lock') }}

- name: Install dependencies
run: npm install

- name: Build Tailwind CSS
run: npx turbo run build --filter=//

- name: Test
run: npx turbo run test --filter=//

- name: Lint
run: npx turbo run style --filter=//
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Tests
name: Integration Tests — Oxide

on:
push:
Expand All @@ -13,6 +13,7 @@ env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: oxide

jobs:
test:
Expand All @@ -30,7 +31,7 @@ jobs:
- vite
- webpack-4
- webpack-5
node-version: [16]
node-version: [18]
fail-fast: false

steps:
Expand All @@ -45,7 +46,7 @@ jobs:
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}

# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
Expand All @@ -63,7 +64,7 @@ jobs:
run: npm install

- name: Build Tailwind CSS
run: npx turbo run oxide:build --filter=//
run: npx turbo run build --filter=//

- name: Test ${{ matrix.integration }}
run: npx turbo run test --filter=./integrations/${{ matrix.integration }}
80 changes: 80 additions & 0 deletions .github/workflows/integration-tests-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Integration Tests — Stable

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: stable

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
integration:
- content-resolution
- parcel
- postcss-cli
- rollup
- rollup-sass
- tailwindcss-cli
- vite
- webpack-4
- webpack-5
node-version: [18]
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Use the `stable` engine
run: |
node ./scripts/swap-engines.js
- name: Cache node_modules (tailwindcss)
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('package-lock.json') }}

- name: Cache node_modules (integrations)
uses: actions/cache@v3
with:
path: ./integrations/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-integrations-${{ hashFiles('./integrations/package-lock.json') }}

- name: Cache node_modules (integration)
uses: actions/cache@v3
with:
path: ./integrations/${{ matrix.integration }}/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-integrations-${{ matrix.integration }}-${{ hashFiles('./integrations/${{ matrix.integration }}/package-lock.json') }}

- name: Install dependencies
run: npm install

- name: Install dependencies (shared integrations)
run: npm install --prefix ./integrations

- name: Install dependencies (integration)
run: npm install --prefix ./integrations/${{ matrix.integration }}

- name: Build Tailwind CSS
run: npm run build

- name: Test ${{ matrix.integration }}
run: npm run test --prefix ./integrations/${{ matrix.integration }}
92 changes: 0 additions & 92 deletions .github/workflows/nodejs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
jobs:
build:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
contents: write # for softprops/action-gh-release to create GitHub release

runs-on: macos-11

Expand All @@ -35,7 +35,7 @@ jobs:
- name: Get release notes
run: |
RELEASE_NOTES=$(npm run release-notes --silent)
RELEASE_NOTES=$(node ./scripts/release-notes.js)
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Expand Down
Loading

0 comments on commit b1f4da7

Please sign in to comment.