* `cargo clippy --fix`
* use `map_while` instead of `filter_map`
- `filter_map()` will run forever if the iterator repeatedly produces an `Err`
```
❯ cargo clippy
Checking tailwindcss-oxide v0.1.0 (/Users/robin/github.com/tailwindlabs/tailwindcss/oxide/crates/cli)
warning: `filter_map()` will run forever if the iterator repeatedly produces an `Err`
--> crates/cli/src/main.rs:108:14
|
108 | .filter_map(Result::ok)
| ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)`
|
note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error
--> crates/cli/src/main.rs:106:9
|
106 | / read_lines(path)
107 | | .unwrap()
| |_____________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
= note: `#[warn(clippy::lines_filter_map_ok)]` on by default
warning: `tailwindcss-oxide` (bin "tailwindcss-oxide") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
```
* log used versions of all the tools we are using
* ensure we install Rust
97 lines
2.5 KiB
YAML
97 lines
2.5 KiB
YAML
name: Integration Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CI: true
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
|
|
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: Cache node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-${{ matrix.node-version }}-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('**/Cargo.lock') }}
|
|
|
|
# Cache the `oxide` Rust build
|
|
- name: Cache oxide build
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./oxide/target/
|
|
./oxide/crates/node/*.node
|
|
./oxide/crates/node/index.js
|
|
./oxide/crates/node/index.d.ts
|
|
key: ${{ runner.os }}-oxide-${{ hashFiles('./oxide/crates/**/*') }}
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Check versions
|
|
run: |
|
|
echo "Node:" `node --version`
|
|
echo "NPM:" `npm --version`
|
|
echo "Rust:" `rustc --version`
|
|
echo "Cargo:" `cargo --version`
|
|
|
|
- name: Build Tailwind CSS
|
|
run: npx turbo run build --filter=//
|
|
|
|
- name: Test ${{ matrix.integration }}
|
|
run: |
|
|
npx turbo run test --filter=./integrations/${{ matrix.integration }} || \
|
|
npx turbo run test --filter=./integrations/${{ matrix.integration }} || \
|
|
npx turbo run test --filter=./integrations/${{ matrix.integration }} || exit 1
|