forked from alibaba/OpenSandbox
-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (92 loc) · 2.82 KB
/
execd-test.yml
File metadata and controls
109 lines (92 loc) · 2.82 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
name: Execd Tests
on:
pull_request:
branches: [ main ]
paths:
- 'components/execd/**'
- 'components/internal/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24.0'
- name: Run golint
run: |
cd components/execd
make golint
- name: Build (Multi platform compile)
run: |
cd components/execd
#
make multi-build
- name: Run tests with coverage
run: |
cd components/execd
go test -v -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./pkg/...
- name: Calculate coverage and generate summary
id: coverage
run: |
cd components/execd
# Extract total coverage percentage
TOTAL_COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
echo "total_coverage=$TOTAL_COVERAGE" >> $GITHUB_OUTPUT
# Generate GitHub Actions job summary
echo "## 📊 execd Test Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Total Line Coverage:** $TOTAL_COVERAGE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Coverage report generated for commit \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
echo "*Coverage targets: Core packages >80%, API layer >70%*" >> $GITHUB_STEP_SUMMARY
smoke:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24.0'
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install make (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: choco install make -y
- name: Build
run: |
cd components/execd
make build
- name: Run smoke test
run: |
cd components/execd
chmod +x tests/smoke.sh
./tests/smoke.sh
sleep 5
python3 tests/smoke_api.py
- name: Show logs
if: always()
run: |
set -x
cat components/execd/startup.log || true
cat components/execd/execd.log || true