forked from opensandbox-group/OpenSandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (133 loc) · 4.44 KB
/
Copy pathexecd-test.yml
File metadata and controls
157 lines (133 loc) · 4.44 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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.25.9'
- name: Check gofmt
working-directory: components/execd
run: |
files="$(gofmt -l . ../internal)"
if [ -n "$files" ]; then
echo "$files"
exit 1
fi
- name: Run golint
working-directory: components/execd
run: |
make golint
- name: Build (Multi platform compile)
working-directory: components/execd
run: |
make multi-build
- name: Run tests with coverage
working-directory: components/execd
run: |
go test -v -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./pkg/...
- name: Calculate coverage and generate summary
working-directory: components/execd
id: coverage
run: |
# 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.25.9'
- 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
working-directory: components/execd
run: |
make build
- name: Run smoke test
working-directory: components/execd
run: |
chmod +x tests/smoke.sh
./tests/smoke.sh
sleep 5
python3 tests/smoke_api.py
- name: SIGTERM forward test
if: matrix.os == 'ubuntu-latest'
working-directory: components/execd
run: |
chmod +x tests/sigterm_forward.sh
./tests/sigterm_forward.sh
- name: Smoke test bwrap (Docker image build + extraction)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
chmod +x components/execd/tests/smoke_bwrap.sh
bash components/execd/tests/smoke_bwrap.sh
- name: Show logs
if: always()
run: |
set -x
cat components/execd/startup.log || true
cat components/execd/execd.log || true
bwrap-smoke:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.9'
- name: Build latest bubblewrap (v0.11.2)
run: |
sudo apt-get install -y meson ninja-build libcap-dev pkg-config
git clone --depth 1 --branch v0.11.2 https://github.com/containers/bubblewrap /tmp/bwrap
cd /tmp/bwrap
meson setup builddir -Dprefix=/usr -Dman=disabled -Dtests=false
ninja -C builddir
sudo cp builddir/bwrap /usr/local/bin/bwrap
bwrap --version
- name: Run bwrap integration tests
working-directory: components/execd
run: sudo -E env "PATH=$PATH" go test -tags="linux,bwrap" -v -count=1 -timeout=5m ./pkg/runtime/bwrap_test/