Skip to content

Commit b12fc5d

Browse files
committed
Add test and lint workflow
Signed-off-by: Alexey Fomenko <alexey.fomenko@intel.com>
1 parent 43e8dd7 commit b12fc5d

File tree

3 files changed

+55
-7
lines changed

3 files changed

+55
-7
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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,27 @@ 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 && \
31-
unset http_proxy https_proxy no_proxy && \
32-
echo 'export PATH=/home/ubuntu/go/bin:$PATH' >> /home/ubuntu/.bashrc
31+
echo 'export PATH=/home/ubuntu/go/bin:$PATH' >> /home/ubuntu/.bashrc && \
32+
wget https://github.com/golangci/golangci-lint/releases/download/v2.7.2/golangci-lint-2.7.2-linux-amd64.tar.gz && \
33+
tar zxf golangci-lint-2.7.2-linux-amd64.tar.gz --strip-components=1 golangci-lint-2.7.2-linux-amd64/golangci-lint && \
34+
mv golangci-lint /usr/local/bin/golangci-lint && \
35+
rm golangci-lint-2.7.2-linux-amd64.tar.gz && \
36+
unset http_proxy https_proxy no_proxy
3337

3438
RUN \
3539
mkdir /github && \
3640
chmod 777 /github && \
3741
mkdir /home/ubuntu/src && \
3842
chown -R ${UID}:${GID} /home/ubuntu
3943

44+
ENV GOROOT=/home/ubuntu/go
4045
ENV GOCACHE=/home/ubuntu/.cache/go-build
4146
ENV GOMODCACHE=/home/ubuntu/.cache/go-mod
4247
ENV PATH=/home/ubuntu/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,26 @@ 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 ./
182193

183194
cilint:
184-
golangci-lint --max-same-issues 0 --max-issues-per-linter 0 run --timeout 2m0s ./...
195+
golangci-lint --max-same-issues 0 --max-issues-per-linter 0 run --timeout 4m0s ./...
185196

186197
vet:
187198
go vet $(PKG)/...
@@ -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)