Skip to content

Update/fix gitlab release pipeline #1555

Update/fix gitlab release pipeline

Update/fix gitlab release pipeline #1555

name: win_build_and_test
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
branches:
- main
pull_request:
concurrency:
group: win_build_and_test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: 1.18.7
RESULT_PATH: testresults
PYTHON_VERSION: 3.8.10
REQUIREMENTS_PATH: "tests/requirements.txt"
jobs:
go-test:
name: go-test
runs-on: ${{ matrix.OS }}
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Caching dependency
uses: actions/cache@v3
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Install gotestsum
run: |
cd $env:TEMP
go install gotest.tools/gotestsum@latest
- name: Run go tests
run: |
& ./scripts/windows/make.ps1 unit_test
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.OS }}-go-test-results
path: unit_results.xml
build:
name: build
runs-on: "windows-2019"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Caching dependency
uses: actions/cache@v3
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Install checksum
run: choco install -y checksum
- name: Install wix
run: choco install -y wixtoolset --version 3.11.2
- name: Build
run: |
refreshenv
$env:PATH = "C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\WiX Toolset v3.11\bin;$env:PATH"
& ./scripts/windows/make.ps1 bundle -build_agent 1 -build_msi 1 -build_choco 1
& ./build/SignalFxAgent/bin/signalfx-agent.exe --version
- name: Archive exe
uses: actions/upload-artifact@v3
with:
name: exe
path: build/SignalFxAgent/bin/signalfx-agent.exe
- name: Archive msi
uses: actions/upload-artifact@v3
with:
name: msi
path: build/SignalFxAgent-*.msi
- name: Archive zip
uses: actions/upload-artifact@v3
with:
name: zip
path: build/SignalFxAgent-*.zip
- name: Archive nupkg
uses: actions/upload-artifact@v3
with:
name: nupkg
path: build/signalfx-agent.*.nupkg
docker-build:
name: docker-build
runs-on: windows-2019
needs:
- build
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download exe
uses: actions/download-artifact@v3
with:
name: exe
path: dist
- name: Build docker image
run: docker build -t signalfx-agent:latest-windows -f Dockerfile.windows .
integration-tests:
name: integration-tests
runs-on: ${{ matrix.OS }}
needs:
- build
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
env:
SANIC_NO_UVLOOP: "true"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download zip
uses: actions/download-artifact@v3
with:
name: zip
path: build
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }}
- name: Install pytest
run: pip install -r "${{ env.REQUIREMENTS_PATH }}"
- name: Install IIS-WebServerRole
run: choco install -y --source windowsfeatures IIS-WebServerRole
- name: Extract bundle
run: |
cd build
7z x SignalFxAgent*.zip
- name: Run integration tests
run: |
$env:AGENT_BIN = $(Resolve-Path build\SignalFxAgent\bin\signalfx-agent.exe)
pytest -m "(windows or windows_only) and not deployment and not installer" --verbose --junitxml=${{ env.RESULT_PATH }}/test_results.xml --html=${{ env.RESULT_PATH }}/test_results.html --self-contained-html tests
- name: Uploading pytest result artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-integration-pytest-result
path: ${{ env.RESULT_PATH }}
installer-tests:
runs-on: ${{ matrix.OS }}
needs:
- build
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
env:
SANIC_NO_UVLOOP: "true"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download msi
uses: actions/download-artifact@v3
with:
name: msi
path: build
- name: Download nupkg
uses: actions/download-artifact@v3
with:
name: nupkg
path: build
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }}
- name: Install pytest
run: pip install -r "${{ env.REQUIREMENTS_PATH }}"
- name: Run installer tests
run: |
$msi_path = $(Resolve-Path build\SignalFxAgent-*.msi)
$nupkg_path = $(Resolve-Path build\signalfx-agent*.nupkg)
pytest -m "installer and windows_only" --test-msi-path="$msi_path" --test-nupkg-path="$nupkg_path" --verbose --junitxml=${{ env.RESULT_PATH }}/test_results.xml --html=${{ env.RESULT_PATH }}/test_results.html --self-contained-html tests
- name: Uploading pytest result artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-installer-pytest-result
path: ${{ env.RESULT_PATH }}