Skip to content

Commit f43c6b5

Browse files
authored
ci: add manual PR checks workflow with slash command support
1 parent 1d9e2da commit f43c6b5

1 file changed

Lines changed: 20 additions & 65 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 20 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
slash-command:
99
name: Parse /run-checks
10-
if: |
10+
if: >-
1111
github.event.issue.pull_request != null &&
1212
contains(github.event.comment.body, '/run-checks')
1313
runs-on: ubuntu-latest
@@ -70,19 +70,13 @@ jobs:
7070
run: |
7171
sudo apt-get install -y clang-format
7272
find . -name "*.cpp" -o -name "*.h" | grep -v "build/" | \
73-
xargs clang-format --dry-run --Werror --style=LLVM || true
73+
xargs clang-format --dry-run --Werror || true
7474
7575
- name: Python lint (ruff)
7676
uses: chartboost/ruff-action@v1
7777
with:
7878
args: "check engine/ --ignore E501 --exit-zero"
7979

80-
- name: TypeScript lint (eslint)
81-
working-directory: frontend
82-
run: |
83-
npm ci --prefer-offline
84-
npx eslint src/ --ext .ts,.tsx --max-warnings 20 || true
85-
8680

8781
build-cpp:
8882
name: Build C++ (${{ matrix.os }})
@@ -132,19 +126,17 @@ jobs:
132126
retention-days: 7
133127

134128

135-
validate-dockerfiles:
136-
name: Validate Dockerfiles
129+
validate:
130+
name: Validate
137131
needs: slash-command
138132
runs-on: ubuntu-latest
139133
steps:
140134
- uses: actions/checkout@v4
141135
with:
142136
ref: ${{ needs.slash-command.outputs.pr-sha }}
143137

144-
145138
- name: Check required files exist
146139
run: |
147-
echo "Checking files referenced by Dockerfiles..."
148140
files=(
149141
"main.cpp"
150142
"engine/main.py"
@@ -161,65 +153,28 @@ jobs:
161153
done
162154
exit $failed
163155
164-
- name: Set up Docker Buildx
165-
uses: docker/setup-buildx-action@v3
166-
167-
- name: Build check — Dockerfile.cpp (C++ engine)
168-
uses: docker/build-push-action@v6
169-
with:
170-
context: .
171-
file: .devops/Dockerfile.cpp
172-
platforms: linux/amd64
173-
push: false
174-
cache-from: type=gha,scope=cpp
175-
cache-to: type=gha,mode=max,scope=cpp
176-
177-
178-
- name: Build check — Dockerfile (PyTorch CPU)
179-
uses: docker/build-push-action@v6
156+
- name: Lint — Dockerfile.cpp
157+
uses: hadolint/hadolint-action@v3.1.0
180158
with:
181-
context: .
182-
file: .devops/Dockerfile
183-
platforms: linux/amd64
184-
push: false
185-
cache-from: type=gha,scope=cpu
186-
cache-to: type=gha,mode=max,scope=cpu
187-
188-
- name: Skip CUDA build check
189-
run: echo "CUDA build skipped on PR checks — run publish-docker workflow to build cuda image."
190-
159+
dockerfile: .devops/Dockerfile.cpp
160+
failure-threshold: error
191161

192-
test-frontend:
193-
name: Frontend Tests
194-
needs: [slash-command, lint]
195-
runs-on: ubuntu-latest
196-
steps:
197-
- uses: actions/checkout@v4
162+
- name: Lint — Dockerfile (CPU)
163+
uses: hadolint/hadolint-action@v3.1.0
198164
with:
199-
ref: ${{ needs.slash-command.outputs.pr-sha }}
165+
dockerfile: .devops/Dockerfile
166+
failure-threshold: error
200167

201-
- uses: actions/setup-node@v4
168+
- name: Lint — Dockerfile.backend (CUDA)
169+
uses: hadolint/hadolint-action@v3.1.0
202170
with:
203-
node-version: "20"
204-
cache: npm
205-
cache-dependency-path: frontend/package-lock.json
206-
207-
- name: Install
208-
working-directory: frontend
209-
run: npm ci --prefer-offline
210-
211-
- name: Type-check
212-
working-directory: frontend
213-
run: npx tsc --noEmit
214-
215-
- name: Build check
216-
working-directory: frontend
217-
run: npm run build
171+
dockerfile: .devops/Dockerfile.backend
172+
failure-threshold: error
218173

219174

220175
post-result:
221176
name: Post result
222-
needs: [slash-command, lint, build-cpp, validate-dockerfiles, test-frontend]
177+
needs: [slash-command, lint, build-cpp, validate]
223178
runs-on: ubuntu-latest
224179
if: always()
225180
steps:
@@ -233,6 +188,6 @@ jobs:
233188
repo: context.repo.repo,
234189
issue_number: context.issue.number,
235190
body: failed
236-
? ' Some checks failed — see Actions for details.'
237-
: ' All checks passed!',
238-
});
191+
? ' Some checks failed — see Actions for details.'
192+
: ' All checks passed!',
193+
});

0 commit comments

Comments
 (0)