summaryrefslogtreecommitdiff
path: root/.github/workflows/rust.yml
blob: d2e8e316b82f5c83aae8a0a545bca1d045c7a0cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Rust

on:
  push:
    branches: [staging, trying, master]
  pull_request:
    branches: [master]

env:
  CARGO_TERM_COLOR: always

jobs:
  all:
    runs-on: ubuntu-20.04
    needs: [build-nightly, build-stable, test]
    steps:
      - name: Done
        run: exit 0
  build-nightly:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Cache multiple paths
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target_ci
          key: rust3-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
      - name: build
        run: |
          curl -L -o /usr/local/bin/cargo-batch https://github.com/embassy-rs/cargo-batch/releases/download/batch-0.3.0/cargo-batch
          chmod +x /usr/local/bin/cargo-batch
          ./ci.sh
          rm -rf target_ci/*{,/release}/{build,deps,.fingerprint}/{lib,}{embassy,stm32}*
  build-stable:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Cache multiple paths
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target_ci_stable
          key: rust-stable-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
      - name: build
        run: |
          curl -L -o /usr/local/bin/cargo-batch https://github.com/embassy-rs/cargo-batch/releases/download/batch-0.3.0/cargo-batch
          chmod +x /usr/local/bin/cargo-batch
          ./ci_stable.sh
          rm -rf target_ci_stable/*{,/release}/{build,deps,.fingerprint}/{lib,}{embassy,stm32}*

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Test
        run: cd embassy-sync && cargo test