Code integration [][] - .4128d2837509372554fc244719858349e6fd7a01 #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AutoBuild | |
on: | |
workflow_dispatch: | |
inputs: | |
x86_version: | |
description: 'Create x86 version' | |
type: boolean | |
default: false | |
required: true | |
do_tests: | |
description: 'do tests' | |
type: boolean | |
default: false | |
required: true | |
push: | |
branches: [ "main", "testing-*", "issue*" ] | |
run-name: Code integration [${{ github.inputs.x86_version }}][${{ github.inputs.do_tests }}] - ${{ github.head_ref }}.${{ github.sha }} | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
# | |
# # Get values for cache paths to be used in later steps | |
# - id: go-cache-paths | |
# run: | | |
# export GOCACHE=~\.cache\go-build | |
# echo "::set-output name=go-build::$(go env GOCACHE)" | |
# echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
# | |
# # Cache go build cache, used to speedup go test | |
# - name: Go Build Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | |
# ${{ steps.go-cache-paths.outputs.go-build }} | |
# key: | |
# ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | |
# | |
# # Cache go mod cache, used to speedup builds | |
# - name: Go Mod Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | |
# ${{ steps.go-cache-paths.outputs.go-mod }} | |
# key: | |
# ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | |
- name: Build 64bits | |
run: | | |
export GOARCH=amd64 | |
export GOOS=linux | |
export CGO_ENABLED=0 | |
go clean -cache | |
go build -v -o build/qpep | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: qpep_linux_b${{ github.run_id }} | |
path: build/qpep | |
unit-tests-linux: | |
needs: [ build-linux ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Prepare | |
run: | | |
mkdir build | |
go install github.com/jstemmer/[email protected] | |
go install github.com/axw/gocov/[email protected] | |
go install github.com/matm/gocov-html/cmd/[email protected] | |
go install github.com/AlekSi/[email protected] | |
- name: Test | |
run: | | |
set -x | |
export GOARCH=amd64 | |
export GOOS=linux | |
export CGO_ENABLED=0 | |
export QPEP_CI_ENV=1 | |
for i in $(go list ./... | grep -v tray | sed -n -e 's/github.com\/parvit\/qpep\///p') | |
do | |
pushd $i | |
go test -v -gcflags=-l -cover -c -o qpep.$(basename $PWD).test || true | |
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=cover.out &> unit_tests.out || true | |
cat unit_tests.out | go-junit-report > ../unit_tests_$(basename $PWD).xml | |
popd | |
done | |
continue-on-error: true | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: "Unit Tests - Linux Platform" | |
junit_files: "unit_tests_*.xml" | |
- name: Publish Coverage Results | |
run: | | |
for i in $(go list ./... | grep -v tray | sed -n -e 's/github.com\/parvit\/qpep\///p') | |
do | |
pushd $i | |
echo "=== Package $i ===" >> $GITHUB_STEP_SUMMARY | |
gocov convert cover.out | gocov report | grep "Total Coverage" >> $GITHUB_STEP_SUMMARY || true | |
gocov convert cover.out | gocov-html -s ../.style.css > ../report_$(basename $PWD).html || true | |
popd | |
done | |
continue-on-error: true | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux_tests_output | |
path: "${{ github.workspace }}/**/unit_tests.out" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux_coverage_report | |
path: report_*.html | |
build-windows: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- uses: actions/checkout@v2 | |
- name: Install Wix | |
uses: actions/checkout@v2 | |
with: | |
repository: fbarresi/wix | |
path: wix | |
- name: Install MSBuild | |
uses: microsoft/[email protected] | |
# | |
# # Get values for cache paths to be used in later steps | |
# - id: go-cache-paths | |
# run: | | |
# set GOCACHE=~\.cache\go-build | |
# echo "::set-output name=go-build::~\.cache\go-build" | |
# echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
# | |
# # Cache go build cache, used to speedup go test | |
# - name: Go Build Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | |
# ${{ steps.go-cache-paths.outputs.go-build }} | |
# key: | |
# ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | |
# | |
# # Cache go mod cache, used to speedup builds | |
# - name: Go Mod Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | |
# ${{ steps.go-cache-paths.outputs.go-mod }} | |
# key: | |
# ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | |
- name: Prepare | |
run: | | |
MKDIR build | |
MKDIR build\64bits | |
MKDIR build\32bits | |
COPY /Y windivert\LICENSE build\LICENSE.windivert | |
COPY /Y LICENSE build\LICENSE | |
set GOARCH=amd64 | |
go clean -cache | |
set GOARCH=386 | |
go clean -cache | |
COPY /Y windivert\x64\* build\64bits | |
- name: Build QPep 64bits | |
run: | | |
set GOARCH=amd64 | |
set CGO_ENABLED=1 | |
go build -o build\64bits\qpep.exe | |
- name: Build QPep Tray 64bits | |
run: | | |
pushd qpep-tray | |
export GOARCH=amd64 | |
export GOOS=windows | |
export CGO_ENABLED=0 | |
go build -ldflags -H=windowsgui -o ..\build\64bits\qpep-tray.exe | |
popd | |
- if: ${{ github.events.inputs.x86_version == true }} | |
name: Set up MinGW | |
uses: egor-tensin/setup-mingw@v2 | |
with: | |
platform: x86 | |
- if: ${{ github.events.inputs.x86_version == true }} | |
name: Build QPep x86 | |
run: | | |
set GOARCH=386 | |
set GOOS=windows | |
set CGO_ENABLED=1 | |
go build -o build\64bits\qpep.exe | |
- if: ${{ github.events.inputs.x86_version == true }} | |
name: Build QPep Tray x86 | |
run: | | |
pushd qpep-tray | |
set GOARCH=386 | |
set GOOS=windows | |
set CGO_ENABLED=0 | |
go build -ldflags -H=windowsgui -o ..\build\32bits\qpep-tray.exe | |
popd | |
- name: Build QPep Installer | |
run: | | |
sed -E 's/Version="[^"]+"/Version="1.0.0.0-dev${{github.run_id}}"/' installer/installer.wxs > installer/installer.wxs | |
sed -E 's/FileVersion:\s*"[^"]+"/FileVersion:\s*"0.0.0-dev${{github.run_id}}"/' version/versioninfo.json > version/versioninfo.json | |
sed -E 's/ProductVersion:\s*"[^"]+"/ProductVersion:\s*"0.0.0-dev${{github.run_id}}"/' version/versioninfo.json > version/versioninfo.json | |
set PATH=${{ github.workspace }}\wix\tools;%PATH% | |
msbuild installer\installer.sln | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: qpep_windows_b${{ github.run_id }} | |
path: build/installer.msi | |
unit-tests-windows: | |
needs: [ build-windows ] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Prepare Test | |
run: | | |
go install github.com/jstemmer/[email protected] | |
go install github.com/axw/gocov/[email protected] | |
go install github.com/matm/gocov-html/cmd/[email protected] | |
go install github.com/AlekSi/[email protected] | |
- name: Test | |
shell: bash | |
run: | | |
set -x | |
export GOARCH=amd64 | |
export GOOS=windows | |
export CGO_ENABLED=0 | |
export QPEP_CI_ENV=1 | |
go generate github.com/parvit/qpep/windivert | |
for i in $(go list ./... | grep -v tray | sed -n -e 's/github.com\/parvit\/qpep\///p') | |
do | |
pushd $i | |
go test -v -gcflags=-l -cover -c -o qpep.$(basename $PWD).test || true | |
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=cover.out &> unit_tests.out || true | |
cat unit_tests.out | go-junit-report > ../unit_tests_$(basename $PWD).xml | |
popd | |
done | |
continue-on-error: true | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action/composite@v2 | |
if: always() | |
with: | |
check_name: "Unit Tests - Windows Platform" | |
junit_files: "unit_tests_*.xml" | |
- name: Test Results | |
shell: bash | |
run: | | |
set -x | |
for i in $(go list ./... | grep -v tray | sed -n -e 's/github.com\/parvit\/qpep\///p') | |
do | |
pushd $i | |
echo "=== Package $i ===" >> $GITHUB_STEP_SUMMARY | |
gocov convert cover.out | gocov report | grep "Total Coverage" >> $GITHUB_STEP_SUMMARY || true | |
gocov convert cover.out | gocov-html -s ../.style.css > ../report_$(basename $PWD).html || true | |
popd | |
done | |
continue-on-error: true | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows_coverage_report | |
path: report_*.html | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows_coverage_report | |
path: unit_tests_*.xml |