Skip to content

feat(add data collect proto in go agent) #84

feat(add data collect proto in go agent)

feat(add data collect proto in go agent) #84

# 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.2.3/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 dos2unix
sudo apt-get update && sudo apt-get install -y unzip
cd ~/repo/skywalking-go
find . -name "*.sh" -exec dos2unix {} \;
make generate-proto
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