-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (113 loc) · 3.8 KB
/
ci.yaml
File metadata and controls
122 lines (113 loc) · 3.8 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
name: ci
# Public-side CI for community contributors. Runs without the parent
# Powernode platform — covers everything that can be validated in
# isolation: ruby syntax, frontend type structure, Go agent tests,
# initramfs script lints. The full rspec suite that requires the
# parent platform's autoloader runs on the Gitea side
# (.gitea/workflows/ci.yaml).
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch: {}
permissions:
contents: read
jobs:
ruby-syntax:
name: Ruby syntax
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.8
- name: Syntax-check every .rb file
run: |
fail=0
while IFS= read -r f; do
ruby -c "$f" >/dev/null || { echo "::error file=${f}::ruby syntax error"; fail=1; }
done < <(find server worker -name '*.rb' 2>/dev/null)
exit $fail
rubocop:
name: Rubocop
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.8
- name: Run rubocop (advisory)
run: |
gem install rubocop --no-document
# Run in advisory mode — this is community CI; we don't fail PRs
# on style yet, but show what would change.
rubocop server worker --no-color --format simple || true
go-agent:
name: Go agent
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: agent/go.sum
- name: Build + test
working-directory: agent
run: |
if [ ! -f go.mod ]; then
echo "agent/ has no go.mod yet — skipping"
exit 0
fi
go vet ./...
go test ./...
# Cross-compile sanity check for both target archs
GOOS=linux GOARCH=amd64 go build -o /tmp/powernode-agent-amd64 ./cmd/powernode-agent
GOOS=linux GOARCH=arm64 go build -o /tmp/powernode-agent-arm64 ./cmd/powernode-agent
frontend-structure:
name: Frontend structure check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Lint imports + check no console.log
run: |
fail=0
# No console.log in production code (community CI gate)
if grep -rn "console\.log" frontend/src/ --include='*.ts' --include='*.tsx' 2>/dev/null; then
echo "::error::console.log found in frontend code; use logger instead"
fail=1
fi
# No `any` type
if grep -rn ": any" frontend/src/ --include='*.ts' --include='*.tsx' 2>/dev/null | grep -v "^.*://"; then
echo "::warning::': any' types found — prefer proper TypeScript types"
fi
exit $fail
shell-lint:
name: Shell scripts (initramfs builders)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: shellcheck
run: |
sudo apt-get update -qq
sudo apt-get install -y shellcheck
fail=0
while IFS= read -r f; do
shellcheck -S warning "$f" || fail=1
done < <(find initramfs -name '*.sh' 2>/dev/null)
exit $fail
yaml-lint:
name: YAML lint (workflows + dracut configs)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: |
pip install yamllint
yamllint -d "{extends: relaxed, rules: {line-length: disable, indentation: {spaces: 2, indent-sequences: consistent}}}" \
.github .gitea initramfs/.gitea 2>&1 | head -50