Skip to content

Commit d1af0b2

Browse files
committed
Add test and lint workflow
Signed-off-by: Alexey Fomenko <[email protected]>
1 parent 43e8dd7 commit d1af0b2

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
test-containerized:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Build test image
19+
run: make test-image
20+
- name: Run lint in container
21+
run: make lint-containerized
22+
- name: Run tests in container
23+
run: make test-containerized
24+
- name: Coverage report
25+
run: make coverage.out
26+
- name: GPU Coverage threshold
27+
run: .github/gpu-scripts/coverage_check.sh gpu-coverage 70
28+
- name: Gaudi Coverage threshold
29+
run: .github/gpu-scripts/coverage_check.sh gaudi-coverage 70
30+
- name: QAT Coverage threshold
31+
run: .github/gpu-scripts/coverage_check.sh qat-coverage 70
32+

Dockerfile.gaudi-test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ COPY --from=go --chown=${UID}:${GID} /usr/local/go /home/ubuntu/go
2121
# add xpu-smi shared library for GPU tests and other dependencies
2222
RUN \
2323
apt-get update && \
24-
apt-get install -y make gcc wget software-properties-common python3-launchpadlib git && \
24+
apt-get install -y make gcc wget software-properties-common python3-launchpadlib git yamllint shellcheck && \
2525
add-apt-repository -y ppa:kobuk-team/intel-graphics && \
2626
apt-get update && \
2727
apt-get install -y libze-intel-gpu1 libze1 intel-metrics-discovery intel-opencl-icd clinfo intel-gsc && \
2828
wget -qO /tmp/xpu-smi.deb https://github.com/intel/xpumanager/releases/download/V1.3.1/xpu-smi_1.3.1_20250724.061629.60921e5e_u24.04_amd64.deb && \
2929
apt-get install -y /tmp/xpu-smi.deb && \
3030
rm /tmp/xpu-smi.deb && \
3131
unset http_proxy https_proxy no_proxy && \
32-
echo 'export PATH=/home/ubuntu/go/bin:$PATH' >> /home/ubuntu/.bashrc
32+
echo 'export PATH=/home/ubuntu/go/bin:$PATH' >> /home/ubuntu/.bashrc && \
33+
wget https://github.com/golangci/golangci-lint/releases/download/v2.7.2/golangci-lint-2.7.2-linux-amd64.tar.gz && \
34+
tar zxf golangci-lint-2.7.2-linux-amd64.tar.gz --strip-components=1 golangci-lint-2.7.2-linux-amd64/golangci-lint && \
35+
mv golangci-lint /usr/local/bin/golangci-lint && \
36+
rm golangci-lint-2.7.2-linux-amd64.tar.gz
3337

3438
RUN \
3539
mkdir /github && \

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,20 @@ licenses: clean-licenses
173173

174174

175175
# linting targets for Go and other code
176-
.PHONY: lint format cilint vet shellcheck yamllint
176+
.PHONY: lint format cilint vet shellcheck yamllint lint-containerized
177177

178-
lint: vendor format cilint vet klogformat shellcheck yamllint
178+
lint-containerized:
179+
$(DOCKER) run \
180+
-e container=yes \
181+
-e http_proxy=$(http_proxy) \
182+
-e https_proxy=$(https_proxy) \
183+
-e no_proxy=$(no_proxy) \
184+
--user $(shell id -u):$(shell id -g) \
185+
-v "$(shell pwd)":/home/ubuntu/src:rw \
186+
"$(TEST_IMAGE)" \
187+
bash -c "cd src && make lint
188+
189+
lint: vendor cilint vet klogformat shellcheck yamllint
179190

180191
format:
181192
gofmt -w -s -l ./
@@ -261,7 +272,7 @@ TEST_TARGET ?= test
261272

262273
test-containerized:
263274
$(DOCKER) run \
264-
-it -e container=yes \
275+
-e container=yes \
265276
-e http_proxy=$(http_proxy) \
266277
-e https_proxy=$(https_proxy) \
267278
-e no_proxy=$(no_proxy) \

0 commit comments

Comments
 (0)