main
yml 68 lines 1.73 KB
Raw
1 name: React Compiler (Rust)
2
3 on:
4 push:
5 branches: [main]
6 pull_request:
7 paths:
8 - compiler/**
9 - .github/workflows/compiler_rust.yml
10
11 permissions: {}
12
13 concurrency:
14 group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.run_id }}
15 cancel-in-progress: true
16
17 env:
18 TZ: /usr/share/zoneinfo/America/Los_Angeles
19 SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
20
21 defaults:
22 run:
23 working-directory: compiler
24
25 jobs:
26 rust:
27 name: Tests
28 runs-on: ubuntu-latest
29 steps:
30 - uses: actions/checkout@v4
31
32 # --- Rust toolchain ---
33 - uses: dtolnay/rust-toolchain@stable
34
35 - name: Cache cargo registry and build
36 uses: actions/cache@v4
37 with:
38 path: |
39 ~/.cargo/registry
40 ~/.cargo/git
41 compiler/target
42 key: cargo-${{ runner.os }}-${{ hashFiles('compiler/Cargo.lock') }}
43 restore-keys: cargo-${{ runner.os }}-
44
45 # --- Node (needed for test scripts) ---
46 - uses: actions/setup-node@v4
47 with:
48 node-version-file: '.nvmrc'
49 cache: yarn
50 cache-dependency-path: compiler/yarn.lock
51
52 - name: Restore cached node_modules
53 uses: actions/cache@v4
54 id: node_modules
55 with:
56 path: '**/node_modules'
57 key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }}
58
59 - run: yarn install --frozen-lockfile
60 if: steps.node_modules.outputs.cache-hit != 'true'
61
62 # --- Build & test ---
63 - run: cargo check
64 - run: cargo build
65 - run: bash scripts/test-babel-ast.sh
66 - run: bash scripts/test-rust-port.sh
67 - run: yarn workspace snap run build
68 - run: yarn snap --rust