aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/testing.yaml
blob: b92345cc10b838d573e7692710bea851ca0c95dc (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI

on:
    pull_request:
    merge_group:

# Cancel previous runs of the same workflow on the same branch.
concurrency:
    group: ${{ github.workflow }}-${{ github.ref }}
    cancel-in-progress: true

jobs:
    typescript:
        name: TypeScript
        runs-on: ubuntu-20.04
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Setup Node.js, pnpm and dependencies
              uses: ./.github/actions/setup-pnpm
              with:
                  token: ${{ secrets.GITHUB_TOKEN }}

            - name: Perform typechecks
              run: pnpm typecheck

    eslint:
        name: ESLint
        runs-on: ubuntu-20.04
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Setup Node.js, pnpm and dependencies
              uses: ./.github/actions/setup-pnpm
              with:
                  token: ${{ secrets.GITHUB_TOKEN }}

            - name: Perform linting
              run: pnpm lint

    rustfmt:
        name: Rust Formatting
        runs-on: ubuntu-20.04
        steps:
            - name: Maximize build space
              if: ${{ runner.os == 'Linux' }}
              uses: easimon/maximize-build-space@master
              with:
                  swap-size-mb: 3072
                  root-reserve-mb: 6144
                  remove-dotnet: 'true'
                  remove-codeql: 'true'
                  remove-haskell: 'true'
                  remove-docker-images: 'true'

            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Symlink target to C:\
              if: ${{ runner.os == 'Windows' }}
              shell: powershell
              run: |
                  New-Item -ItemType Directory -Force -Path C:\nexus_target
                  New-Item -Path target -ItemType Junction -Value C:\nexus_target

            - uses: dorny/paths-filter@v2
              id: filter
              with:
                  filters: |
                      changes:
                        - 'apps/cli/*/**'
                        - 'apps/desktop/crates/*/**'
                        - 'apps/desktop/src-tauri/*/**'
                        - 'core/**'
                        - 'crates/*/**'
                        - 'Cargo.toml'
                        - 'Cargo.lock'

            - name: Setup Rust
              if: steps.filter.outputs.changes == 'true'
              uses: ./.github/actions/setup-rust

            - name: Run rustfmt
              if: steps.filter.outputs.changes == 'true'
              run: cargo fmt --all -- --check

    clippy:
        name: Clippy (${{ matrix.platform }})
        runs-on: ${{ matrix.platform }}
        strategy:
            matrix:
                platform: [ubuntu-20.04, macos-latest, windows-latest]
        steps:
            - name: Maximize build space
              if: ${{ runner.os == 'Linux' }}
              uses: easimon/maximize-build-space@master
              with:
                  swap-size-mb: 3072
                  root-reserve-mb: 6144
                  remove-dotnet: 'true'
                  remove-codeql: 'true'
                  remove-haskell: 'true'
                  remove-docker-images: 'true'

            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Symlink target to C:\
              if: ${{ runner.os == 'Windows' }}
              shell: powershell
              run: |
                  New-Item -ItemType Directory -Force -Path C:\nexus_target
                  New-Item -Path target -ItemType Junction -Value C:\nexus_target

            - uses: dorny/paths-filter@v2
              id: filter
              with:
                  # this is also designing ahead for tauri
                  filters: |
                      changes:
                        - 'apps/cli/*/**'
                        - 'apps/desktop/crates/*/**'
                        - 'apps/desktop/src-tauri/*/**'
                        - 'core/**'
                        - 'crates/*/**'
                        - 'Cargo.toml'
                        - 'Cargo.lock'

            - name: Setup System and Rust
              if: steps.filter.outputs.changes == 'true'
              uses: ./.github/actions/setup-system
              with:
                  token: ${{ secrets.GITHUB_TOKEN }}

            - name: Run Clippy
              if: steps.filter.outputs.changes == 'true'
              uses: actions-rs/clippy-check@v1
              with:
                  args: --workspace --all-features
                  token: ${{ secrets.GITHUB_TOKEN }}