aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/clippy-check-example.yml
blob: e1a5f62102f7af2e782b58fe75fb8d8f3b8765bc (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
73
74
name: check-clippy-examples
on:
  workflow_call:
    inputs:
      backend:
        description: The backend to execute for
        required: true
        type: string

      platform:
        description: The platform to execute for
        required: true
        type: string

      # TODO: get this from `cargo xtask`!
      rustup-target:
        description: The rustup target to install
        required: true
        type: string

      example-args:
        description: Extra args to pass when checking examples
        required: false
        type: string

jobs:
  check:
    runs-on: ubuntu-22.04
    name: Validate platform ${{ inputs.platform }}, backend ${{ inputs.backend }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Configure Rust target ${{ inputs.rustup-target }}
        run: rustup target add ${{ inputs.rustup-target }}

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - run: cargo xtask --deny-warnings check -p ${{ inputs.platform }} -b ${{ inputs.backend }}

  check-examples:
    runs-on: ubuntu-22.04
    name: Check examples
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Configure Rust target ${{ inputs.rustup-target }}
        run: rustup target add ${{ inputs.rustup-target }}

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: Check the examples
        run: cargo xtask example-check --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} ${{ inputs.example-args }}

  clippy:
    runs-on: ubuntu-22.04
    name: Run clippy
    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Configure Rust target ${{ inputs.rustup-target }}
      run:  rustup target add ${{ inputs.rustup-target }}

    - name: Add Rust component clippy
      run: rustup component add clippy

    - name: Cache Dependencies
      uses: Swatinem/rust-cache@v2

    - run: cargo xtask --deny-warnings --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} clippy