Skip to content

Commit 613b7cb

Browse files
fix(github-workflow): :zas: update workflow
1 parent c900960 commit 613b7cb

File tree

3 files changed

+50
-36
lines changed

3 files changed

+50
-36
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,45 @@ name: Test Suite
33

44
on: [push, pull_request]
55

6+
env:
7+
MIN_COVERAGE: 70
8+
69
jobs:
710
test:
811
runs-on: ubuntu-latest
9-
container:
10-
image: aynrand
11-
credentials:
12-
username: ${{ github.actor }}
13-
password: ${{ secrets.GITHUB_TOKEN }}
14-
1512
steps:
1613
- name: Checkout code
1714
uses: actions/checkout@v4
1815

19-
- name: Run tests
16+
- name: Set up Docker
2017
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y docker.io
20+
sudo systemctl start docker
21+
22+
- name: Build Docker image
23+
run: docker build -t aynrand .
24+
25+
- name: Run tests and coverage
26+
run: |
27+
output=$(docker run -v $(pwd):/app aynrand sh -c "make test && sui move coverage summary")
28+
echo "$output"
29+
30+
# Extract coverage percentage
31+
coverage=$(echo "$output" | grep -oP 'Total coverage: \K\d+')
32+
if [ -z "$coverage" ]; then
33+
echo "::error::Failed to parse code coverage"
34+
exit 1
35+
fi
36+
37+
echo "Code coverage: $coverage%"
38+
# Check coverage threshold
39+
if [ $coverage -lt $MIN_COVERAGE ]; then
40+
echo "::error::Code coverage below ${MIN_COVERAGE}% (current: ${coverage}%)"
41+
exit 1
42+
fi
43+
44+
2145
make test
2246
sui move coverage summary
2347

Dockerfile

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,21 @@
22
FROM rust:latest AS builder
33

44
# Install dependencies
5-
RUN apt-get update && apt-get install -y \
6-
cmake \
7-
clang \
8-
git \
9-
curl \
10-
libssl-dev \
11-
pkg-config
5+
RUN apt-get update && \
6+
apt-get install -y cmake clang git curl libssl-dev pkg-config && \
7+
rm -rf /var/lib/apt/lists/*
128

139
# Build SUI from source
14-
RUN git clone https://github.com/MystenLabs/sui.git && \
15-
cd sui && \
16-
git checkout devnet && \
17-
cargo build --release --bin sui
10+
RUN cargo install --debug --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui
1811

19-
# Runtime image
20-
FROM rust:slim
21-
COPY --from=builder /sui/target/release/sui /usr/local/bin/
12+
# Runtime stage
13+
FROM debian:bullseye-slim
2214

23-
# Install Bun for commitlint
24-
RUN curl -fsSL https://bun.sh/install | bash && \
25-
apt-get update && apt-get install -y git
15+
# Install runtime dependencies
16+
RUN apt-get update && \
17+
apt-get install -y --no-install-recommends ca-certificates libssl-dev && \
18+
rm -rf /var/lib/apt/lists/*
2619

27-
WORKDIR /app
28-
COPY . .
20+
COPY --from=builder /sui/target/release/sui /usr/local/bin/
2921

30-
# Default command
31-
CMD ["sui", "move", "test"]
22+
WORKDIR /app

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ KEY_LIST=$(KEY) generate ed25519
2828
EMOJI_BUILD=📦
2929
EMOJI_TEST=🧪
3030
EMOJI_CLEAN=🧹
31-
#EMOJI_COV=
31+
EMOJI_COV=📊
3232
EMOJI_FAUCET=🫰
3333
EMOJI_GAS=⛽
3434
EMOJI_KEY=🔑
@@ -62,15 +62,15 @@ clean:
6262
rm -rf build
6363
rm -rf target
6464

65-
#coverage:
66-
## @echo "$(EMOJI_COV) Generating test coverage reports..."
67-
## $(TEST)
68-
## $(COV) || echo "No coverage data available"
65+
coverage:
66+
@echo "$(EMOJI_COV) Generating test coverage reports..."
67+
$(TEST)
68+
$(COV) || echo "No coverage data available"
6969

7070
## Operational Commands
7171
faucet:
7272
@echo "$(EMOJI_FAUCET) Gimme the fake money..."
73-
# $(FAUCET)
73+
$(FAUCET)
7474
@echo "$(EMOJI_GAS) Show me the gass..."
7575
$(GAS)
7676

@@ -106,8 +106,7 @@ help:
106106
@echo " build - $(EMOJI_BUILD) Compile the Move package"
107107
@echo " test - $(EMOJI_TEST) Run project tests"
108108
@echo " clean - $(EMOJI_CLEAN) Remove build artifacts"
109-
110-
## @echo " coverage - $(EMOJI_COV) Generate test coverage report"
109+
@echo " coverage - $(EMOJI_COV) Generate test coverage report"
111110
@echo " faucet - $(EMOJI_FAUCET) Request testnet tokens"
112111
@echo " publish - $(EMOJI_PUBLISH) Publish Move package"
113112

0 commit comments

Comments
 (0)