Skip to content

Commit

Permalink
Introduce GitHub Actions build/test/publish workflow (#3432)
Browse files Browse the repository at this point in the history
This ports most of the build-publish workflow from CircleCI to Github
Actions.

Pending work items:

- Enable publish-dev and publish-stable jobs (disbaled for now; need to
setup secrets with proper protection).
- Integrate github issuegenerator to report some failures such as
loadtest as github issues.
- Disable CircleCI.
  • Loading branch information
owais authored Jun 8, 2021
1 parent 750b125 commit 2378271
Show file tree
Hide file tree
Showing 8 changed files with 681 additions and 5 deletions.
607 changes: 607 additions & 0 deletions .github/workflows/build-and-test.yml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .github/workflows/scripts/set_release_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TAG="${GITHUB_REF##*/}"
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+.* ]]
then
echo "::set-output name=tag::$TAG"
fi
18 changes: 18 additions & 0 deletions .github/workflows/scripts/setup_e2e_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TESTS="$(make -s -C testbed list-tests | xargs echo|sed 's/ /|/g')"
TESTS=(${TESTS//|/ })
MATRIX="{\"include\":["
curr=""
for i in "${!TESTS[@]}"; do
if (( i > 0 && i % 2 == 0 )); then
curr+="|${TESTS[$i]}"
else
if [ -n "$curr" ] && (( i>1 )); then
MATRIX+=",{\"test\":\"$curr\"}"
elif [ -n "$curr" ]; then
MATRIX+="{\"test\":\"$curr\"}"
fi
curr="${TESTS[$i]}"
fi
done
MATRIX+=",{\"test\":\"$curr\"}]}"
echo "::set-output name=loadtest_matrix::$MATRIX"
11 changes: 11 additions & 0 deletions .github/workflows/scripts/setup_stability_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TESTS="$(make -s -C testbed list-stability-tests | xargs echo|sed 's/ /|/g')"

TESTS=(${TESTS//|/ })
MATRIX="{\"include\":["
curr=""
for i in "${!TESTS[@]}"; do
curr="${TESTS[$i]}"
MATRIX+="{\"test\":\"$curr\"},"
done
MATRIX+="]}"
echo "::set-output name=stabilitytest_matrix::$MATRIX"
22 changes: 22 additions & 0 deletions .github/workflows/scripts/verify-dist-files-exist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
files=(
bin/otelcontribcol_darwin_amd64
bin/otelcontribcol_linux_arm64
bin/otelcontribcol_linux_amd64
bin/otelcontribcol_windows_amd64.exe
dist/otel-contrib-collector-*.arm64.rpm
dist/otel-contrib-collector_*_amd64.deb
dist/otel-contrib-collector-*.x86_64.rpm
dist/otel-contrib-collector_*_arm64.deb
dist/otel-contrib-collector-*amd64.msi

);
for f in "${files[@]}"
do
if [[ ! -f $f ]]
then
echo "$f does not exist."
echo "::set-output name=passed::false"
exit 0
fi
done
echo "::set-output name=passed::true"
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ gotidy:
$(MAKE) for-all CMD="rm -fr go.sum"
$(MAKE) for-all CMD="go mod tidy"

.PHONY: gomoddownload
gomoddownload:
@$(MAKE) for-all CMD="go mod download"

.PHONY: gotestinstall
gotestinstall:
@$(MAKE) for-all CMD="make test GOTEST_OPT=\"-i\""

.PHONY: gotest
gotest:
$(MAKE) for-all CMD="make test"
Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ common: checklicense checkdoc impi lint misspell

.PHONY: test
test:
$(GOTEST) ./...
$(GOTEST) $(GOTEST_OPT) ./...

.PHONY: do-unit-tests-with-cover
do-unit-tests-with-cover:
Expand Down
13 changes: 9 additions & 4 deletions internal/buildscripts/packaging/msi/make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Param(

$ErrorActionPreference = "Stop"

function Set-Path {
$Env:Path += ";C:\Program Files (x86)\WiX Toolset v3.11\bin"
}

function Install-Tools {
# disable progress bar support as this causes CircleCI to crash
$OriginalPref = $ProgressPreference
Expand All @@ -35,21 +39,21 @@ function Install-Tools {
$ProgressPreference = $OriginalPref

choco install wixtoolset -y
setx /m PATH "%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin"
refreshenv
}

function New-MSI(
[string]$Version="0.0.1",
[string]$Config="./examples/tracing/otel-collector-config.yml"
) {
candle -arch x64 -dVersion="$Version" -dConfig="$Config" internal/buildscripts/packaging/msi/opentelemetry-contrib-collector.wxs
light opentelemetry-contrib-collector.wixobj
Set-Path
candle.exe -arch x64 -dVersion="$Version" -dConfig="$Config" internal/buildscripts/packaging/msi/opentelemetry-contrib-collector.wxs
light.exe opentelemetry-contrib-collector.wixobj
mkdir dist -ErrorAction Ignore
Move-Item -Force opentelemetry-contrib-collector.msi dist/otel-contrib-collector-$Version-amd64.msi
}

function Confirm-MSI {
Set-Path
# ensure system32 is in Path so we can use executables like msiexec & sc
$env:Path += ";C:\Windows\System32"
$msipath = Resolve-Path "$pwd\dist\otel-contrib-collector-*-amd64.msi"
Expand All @@ -73,3 +77,4 @@ function Confirm-MSI {

$sb = [scriptblock]::create("$Target")
Invoke-Command -ScriptBlock $sb
exit 0

0 comments on commit 2378271

Please sign in to comment.