-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 1.57 KB
/
lint-format.yml
File metadata and controls
68 lines (55 loc) · 1.57 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
name: Lint and Format
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: openharmony-zig/setup-zig-ohos@v0.1.0
with:
tag: '0.16.0'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Validate prek config
run: npm exec --yes --package @j178/prek -- prek validate-config prek.toml
- name: Check Zig syntax
run: |
set -euo pipefail
while IFS= read -r -d '' file; do
zig ast-check "$file"
done < <(git ls-files -z '*.zig')
while IFS= read -r -d '' file; do
zig ast-check --zon "$file"
done < <(git ls-files -z '*.zon')
- name: Build root package
run: zig build --summary all
format:
runs-on: ubuntu-latest
name: Format
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: openharmony-zig/setup-zig-ohos@v0.1.0
with:
tag: '0.16.0'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Check formatting
run: |
set -euo pipefail
git ls-files -z '*.zig' '*.zon' | xargs -0 zig fmt
git ls-files -z '*.js' '*.jsx' '*.ts' '*.tsx' '*.ets' \
| xargs -0 npm exec --yes --package @ohos-rs/oxk -- oxk format
git diff --exit-code