-
Notifications
You must be signed in to change notification settings - Fork 528
153 lines (143 loc) · 4.03 KB
/
push.yaml
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
143
144
145
146
147
148
149
150
151
152
153
name: "Test"
on:
push:
branches:
- master
pull_request:
env:
RUST_BACKTRACE: full
jobs:
changes:
runs-on: ubuntu-latest
outputs:
node: ${{ steps.filter.outputs.node }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
workflows: &workflows
- '.github/workflows/**'
- '.github/actions/**'
node:
- *workflows
- 'apps/desktop/**'
- 'package.json'
- 'pnpm-lock.yaml'
common-rust: &rust
- *workflows
- 'Cargo.lock'
- 'Cargo.toml'
rust: &any-rust
- *rust
- 'crates/**'
lint-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm lint
check-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm check
unittest-node:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-env-node
- run: pnpm test
rust-lint:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- run: cargo fmt --check --all
- run: cargo check --workspace --all-targets
rust-docs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
# TODO(qix-): we have to exclude the app here for now because for some
# TODO(qix-): reason it doesn't build with the docs feature enabled.
- run: cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
env:
RUSTDOCFLAGS: -Dwarnings
rust-test:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/gitbutlerapp/ci-base-image:latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
# Specifies which features should be applied when running the checks and tests
# '' indicates no flags relating to features passed
# [] indicates --no-default-features flag passed
# '*' indicates --all-features passed
# [entry1, entry2] indicates --features entry1 entry2
features:
- ''
- '*'
- []
- [tokio]
- [devtools]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/check-crate
with:
features: ${{ toJson(matrix.features) }}
check-rust:
if: always()
needs:
- changes
- check-rust-windows
- rust-test
- rust-lint
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
check-rust-windows:
needs: changes
runs-on: windows-latest
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
with:
shared-key: windows-rust-testing
key: ${{ inputs.features }}
- name: "cargo check"
run: cargo check --workspace --all-targets --features windows