Repository navigation
112 lines (110 loc) · 3.62 KB
/
Copy pathcode_check_infra.yml
File metadata and controls
112 lines (110 loc) · 3.62 KB
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
# DO NOT EDIT — regenerate with `cargo x workflows` (from the repository root).
# Source: tooling/xtask/crates/xtask_workflows/src/workflows/code_check_infra.rs
name: infra code check
'on':
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
jobs:
path-check:
runs-on: namespace-profile-linux-small
outputs:
should_run: ${{ steps.filter.outputs.should_run }}
steps:
- name: Checkout Repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- id: filter
name: Filter changed paths
uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590
with:
filters: |
should_run:
- 'infra/**'
- 'flake.nix'
- 'flake.lock'
- '.github/actions/setup-nix-dev-shell/**'
- '.github/actions/teardown-nix/**'
- '.github/workflows/code_check_infra.yml'
biome-check:
needs:
- path-check
if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false
name: Biome Check
runs-on: namespace-profile-linux-small;overrides.cache-tag=web-ci
steps:
- name: Checkout Repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
fetch-depth: '0'
- name: Mount /nix cache volume
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0
with:
cache: nix
continue-on-error: true
- name: Setup Nix
uses: './.github/actions/setup-nix'
- name: Setup Nix dev shell
uses: './.github/actions/setup-nix-dev-shell'
- name: Run Biome
run: biome ci --changed --no-errors-on-unmatched --error-on-warnings
working-directory: infra
- name: Teardown Nix
if: always()
uses: './.github/actions/teardown-nix'
check:
needs:
- path-check
if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false
runs-on: namespace-profile-linux-small;overrides.cache-tag=web-ci
steps:
- name: Checkout Repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- name: Mount Namespace cache volume
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0
with:
cache: nix
path: /home/runner/.bun/install/cache
continue-on-error: true
- name: Setup Nix
uses: './.github/actions/setup-nix'
- name: Setup Nix dev shell
uses: './.github/actions/setup-nix-dev-shell'
- name: install
run: bun install --frozen-lockfile
working-directory: infra
- name: check
run: bun run check
working-directory: infra
- name: Teardown Nix
if: always()
uses: './.github/actions/teardown-nix'
status-check:
needs:
- path-check
- biome-check
- check
if: always()
name: Infra Status Check
runs-on: namespace-profile-linux-small
steps:
- name: Check job results
run: |
echo "path-check: ${{ needs.path-check.result }}"
echo "biome-check: ${{ needs.biome-check.result }}"
echo "check: ${{ needs.check.result }}"
# Fail if any job failed (skipped and success are both OK)
if [[ "${{ needs.path-check.result }}" == "failure" ]] || \
[[ "${{ needs.biome-check.result }}" == "failure" ]] || \
[[ "${{ needs.check.result }}" == "failure" ]]; then
echo "❌ One or more jobs failed"
exit 1
fi
echo "✅ All jobs passed or were skipped"
concurrency:
group: code-check-infra-${{ github.ref }}
cancel-in-progress: true