-
Notifications
You must be signed in to change notification settings - Fork 117
176 lines (152 loc) · 6.68 KB
/
Copy pathwindows-plugin-test.yaml
File metadata and controls
176 lines (152 loc) · 6.68 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Windows Plugin Tests
concurrency:
group: windows-plugins-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
test-on-windows:
runs-on: windows-latest
steps:
- name: firewall
shell: pwsh
run: |
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
- name: Install and Configure WSL 2
shell: pwsh
run: |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
wsl --set-default-version 2
wsl --update
$distros = (Invoke-RestMethod -Uri https://raw.githubusercontent.com/microsoft/WSL/refs/heads/master/distributions/DistributionInfo.json).Distributions
$distroDownloadUrl = $distros.Where({ $_.Name -eq 'Ubuntu' }).Amd64PackageUrl
Set-Location $env:GITHUB_WORKSPACE\..\..
$filename = "Ubuntu$([System.IO.Path]::GetExtension($distroDownloadUrl))"
Invoke-WebRequest -Uri $distroDownloadUrl -OutFile $filename
Expand-Archive -Path $filename -DestinationPath .\
$distroExe = (Get-ChildItem -Path . -Filter *.exe).Where({ $_.Name -notmatch 'splash|setup' }).FullName
& $distroExe install --root
@'
@echo off
FOR /F "usebackq tokens=*" %%F IN (`wsl wslpath '%~1'`) DO SET wslpath=%%F
wsl -d Ubuntu sed -i 's/\r$//' %wslpath%
wsl -d Ubuntu --cd %GITHUB_WORKSPACE% bash --noprofile --norc -eo pipefail %wslpath%
'@ | Out-File -FilePath $env:RUNNER_TEMP\wsl-run.bat -Encoding utf8
$env:RUNNER_TEMP >> $env:GITHUB_PATH
- name: WSL - Setup Docker
shell: wsl-run {0}
run: |
for i in {1..3}; do
sudo rm -r /var/lib/apt/lists/*
sudo mkdir /var/lib/apt/lists/partial
sudo apt-get update -qq && break || echo "apt-get update failed, retrying ($i)…"
done
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
for i in {1..3}; do
sudo rm -r /var/lib/apt/lists/*
sudo mkdir /var/lib/apt/lists/partial
sudo apt-get update -qq && break || echo "apt-get update failed, retrying ($i)…"
done
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo service docker start
curl -SL https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: WSL – Install Go 1.19
shell: wsl-run {0}
run: |
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> ~/.profile
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'export PATH=$GOROOT/bin:$GOPATH/bin:$PATH' >> ~/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
go version
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Copy code to WSL home
shell: wsl-run {0}
run: |
mkdir -p ~/repo
cp -r /mnt/d/a/skywalking-go/* ~/repo/
- name: WSL – Build
shell: wsl-run {0}
run: |
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
sudo apt-get install -y build-essential
cd ~/repo/skywalking-go/test/plugins
mkdir -p dist
cd validator && docker build . -t skywalking/agent-test-validator:1.0.0
docker save -o ../dist/skywalking-agent-test-validator-1.0.0.tgz skywalking/agent-test-validator:1.0.0
- name: Copy WSL to Windows
shell: wsl-run {0}
run: |
sudo cp -rf ~/repo/* /mnt/d/a/skywalking-go
- name: Windows Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: WSL Setup Tools
shell: wsl-run {0}
run: |
cd ~/repo/skywalking-go
cp -rf /mnt/d/a/skywalking-go/skywalking-go/test/plugins/dist/* test/plugins/dist/
chmod +x test/plugins/dist/*
if ls test/plugins/dist/skywalking-agent-test-validator-1.0.0.tgz; then
docker load -i test/plugins/dist/skywalking-agent-test-validator-1.0.0.tgz
fi
- name: Run Windows Server
run: |
choco install yq
cd test/plugins
head -n -2 Makefile > temp && rm Makefile && mv temp Makefile
make build os=windows
bash run.sh http
- uses: actions/upload-artifact@v4
name: Upload Agent
if: ${{ failure() }}
with:
path: test/plugins/workspace
name: test-plugins-workspace-http-windows
required:
if: always()
name: Windows Plugin Tests
needs:
- test-on-windows
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Merge Requirement
run: |
if [[ ${{ needs.test-on-windows.result }} != 'success' ]]; then
exit -1
fi