tailwindcss/.github/workflows/ci.yml
Robin Malfait b05b617601
Bump Rust version to 1.70.0 (#11344)
* `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
2023-06-02 15:24:40 +02:00

96 lines
2.3 KiB
YAML

name: CI
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:
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 }}-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 (Node.js)
run: |
npx turbo run test --filter=// || \
npx turbo run test --filter=// || \
npx turbo run test --filter=// || exit 1
- name: Test (Rust)
run: |
cd ./oxide
cargo test || \
cargo test || \
cargo test || exit 1
cd -
- name: Lint
run: npx turbo run style --filter=//