-
-
Notifications
You must be signed in to change notification settings - Fork 347
150 lines (142 loc) · 4.45 KB
/
ci_pr.yml
File metadata and controls
150 lines (142 loc) · 4.45 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
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
name: CI - PR
'on':
pull_request:
branches:
- main
jobs:
lint:
name: Run Linters
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- id: yamllint
name: Yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
yamllint_flags: '.'
fail_level: error
filter_mode: nofilter
continue-on-error: true
- id: eslint
name: ESLint
uses: reviewdog/action-eslint@v1.33
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
eslint_flags: --ext js,jsx .
fail_level: error
filter_mode: nofilter
workdir: website
continue-on-error: true
- if: ${{ steps.yamllint.outcome == 'failure' }}
run: mkdir -p lint && echo "yamllint" >> lint/results.txt
- if: ${{ steps.eslint.outcome == 'failure' }}
run: mkdir -p lint && echo "eslint" >> lint/results.txt
- uses: actions/upload-artifact@v5
with:
name: lint
path: lint/results.txt
retention-days: 5
if-no-files-found: ignore
- name: Report linters error
if: ${{ steps.yamllint.outcome == 'failure' || steps.eslint.outcome == 'failure' }}
run: exit 1
format-lint:
name: Run formatters to check code formatting
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- id: prettier
name: Prettier Check
uses: creyD/prettier_action@v4.3
with:
dry: true
prettier_options: --write .
prettier_version: 3.5.0
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- if: ${{ always() && steps.prettier.outcome == 'failure' }}
run: mkdir -p format-lint && echo "prettier" >> format-lint/results.txt
- if: ${{ always() && steps.prettier.outcome == 'failure' }}
uses: actions/upload-artifact@v5
with:
name: format-lint
path: format-lint/results.txt
if-no-files-found: ignore
build:
name: Check website build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Website - Build
run: cd website && pnpm build
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
changes:
name: Analyze changes
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
list-files: json
filters: |
blueprints:
- 'blueprints/**/*.yaml'
- if: ${{ steps.changes.outputs.blueprints == 'true' }}
id: blueprints_urls
env:
FILES: ${{ steps.changes.outputs.blueprints_files }}
REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: |
mapfile -t files < <( jq '.[]' < <(echo ${FILES}) )
for f in ${files[@]}; do echo "https://github.com/${REPO}/blob/${GITHUB_HEAD_REF}/$(echo $f | tr -d '"')" >> blueprints.txt; done
- env:
PR_NUM: ${{ github.event.number }}
run: echo $PR_NUM > pr_num.txt
- uses: actions/upload-artifact@v5
with:
name: changes_blueprints
path: blueprints.txt
retention-days: 5
if-no-files-found: ignore
- uses: actions/upload-artifact@v5
with:
name: changes_pr_num
path: pr_num.txt
retention-days: 5