-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate CircleCI workflows to GitHub Actions (2/3) #37
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,13 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- name: Restore module cache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-go-modules | ||
with: | ||
path: /home/runner/go/pkg/mod | ||
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }} | ||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
|
@@ -125,3 +132,207 @@ jobs: | |
with: | ||
name: collector-binaries | ||
path: ./bin | ||
loadtestpre: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.splitloadtest.outputs.matrix }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Restore module cache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-go-modules | ||
with: | ||
path: /home/runner/go/pkg/mod | ||
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }} | ||
- name: split loadtest jobs | ||
id: splitloadtest | ||
run: | | ||
TESTS="$(make -s testbed-list-loadtest | 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+="]}" | ||
echo "::set-output name=matrix::$MATRIX" | ||
Comment on lines
+160
to
+177
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section of the code is what creates the strategy.matrix JSON |
||
loadtest: | ||
runs-on: ubuntu-latest | ||
needs: [setup-environment, loadtestpre] | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.loadtestpre.outputs.matrix) }} | ||
env: | ||
TEST_RESULTS: testbed/tests/results/junit/results.xml | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- name: Download tool binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: tool-binaries | ||
path: /home/runner/go/bin | ||
- name: Add execute permissions to tool binaries | ||
run: chmod -R +x /home/runner/go/bin | ||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Restore module cache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-go-modules | ||
with: | ||
path: /home/runner/go/pkg/mod | ||
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }} | ||
- name: Install fluentbit | ||
if: ${{ contains(matrix.test, 'Log10kDPS') }} | ||
run: | | ||
wget https://packages.fluentbit.io/ubuntu/bionic/pool/main/t/td-agent-bit/td-agent-bit_1.5.3_amd64.deb | ||
sudo dpkg -i ./td-agent-bit*.deb | ||
echo "/opt/td-agent-bit/bin" >> $GITHUB_PATH | ||
sudo ln -s /opt/td-agent-bit/bin/td-agent-bit /usr/local/bin/fluent-bit | ||
- run: mkdir -p results && touch results/TESTRESULTS.md | ||
- name: Loadtest | ||
run: make testbed-loadtest | ||
env: | ||
TEST_ARGS: "-test.run=${{ matrix.test }}" | ||
- name: Create test result archive # some test results have invalid characters | ||
if: ${{ failure() || success() }} | ||
continue-on-error: true | ||
run: tar -cvf test_results.tar testbed/tests/results | ||
Comment on lines
+223
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
- name: Upload test results | ||
if: ${{ failure() || success() }} | ||
continue-on-error: true | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test-results | ||
path: test_results.tar | ||
- name: GitHub issue generator | ||
if: ${{ failure() && github.ref == 'ref/head/master' }} | ||
run: | | ||
go run cmd/issuegenerator/main.go $TEST_RESULTS | ||
correctness: | ||
runs-on: ubuntu-latest | ||
needs: [setup-environment] | ||
env: | ||
TEST_RESULTS: testbed/tests/results/junit/results.xml | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- name: Download tool binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: tool-binaries | ||
path: /home/runner/go/bin | ||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Add execute permissions to tool binaries | ||
run: chmod -R +x /home/runner/go/bin | ||
- name: Restore module cache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-go-modules | ||
with: | ||
path: /home/runner/go/pkg/mod | ||
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }} | ||
- name: Loadtest | ||
run: make testbed-correctness | ||
- name: GitHub issue generator | ||
if: ${{ failure() && github.ref == 'ref/head/master' }} | ||
run: | | ||
go run cmd/issuegenerator/main.go $TEST_RESULTS | ||
build-package: | ||
runs-on: ubuntu-latest | ||
needs: [cross-compile] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package_type: ["deb", "rpm"] | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
mkdir bin/ | ||
- name: Install Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.6' | ||
- name: Install fpm and dependencies | ||
run: gem install --no-document fpm -v 1.11.0 | ||
- name: Download tool binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: tool-binaries | ||
path: /home/runner/go/bin | ||
- name: Download collector binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: collector-binaries | ||
path: ./bin | ||
- name: Add execute permissions to downloaded binaries | ||
run: | | ||
chmod -R +x /home/runner/go/bin | ||
chmod -R +x ./bin | ||
- name: Set Release Tag | ||
id: github_tag | ||
run: | | ||
TAG="${GITHUB_REF##*/}" | ||
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+.* ]] | ||
then | ||
echo "::set-output name=tag::$TAG" | ||
fi | ||
- name: Build ${{ matrix.package_type }} amd64 package | ||
run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "amd64" "./dist/" | ||
- name: Build ${{ matrix.package_type }} arm64 package | ||
run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "arm64" "./dist/" | ||
- name: Test ${{ matrix.package_type }} package | ||
run: | | ||
if [[ "${{ matrix.package_type }}" = "deb" ]]; then | ||
./internal/buildscripts/packaging/fpm/test.sh dist/otel-collector*amd64.deb | ||
else | ||
./internal/buildscripts/packaging/fpm/test.sh dist/otel-collector*x86_64.rpm | ||
fi | ||
- name: Upload Packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-packages | ||
path: ./dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ type DataReceiverBase struct { | |
Port int | ||
} | ||
|
||
const DefaultHost = "localhost" | ||
const DefaultHost = "127.0.0.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line was causing an error with the fluentbit log test since |
||
|
||
func (mb *DataReceiverBase) ReportFatalError(err error) { | ||
log.Printf("Fatal error reported: %v", err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ func TestIdleMode(t *testing.T) { | |
) | ||
defer tc.Stop() | ||
|
||
tc.SetResourceLimits(testbed.ResourceSpec{ExpectedMaxCPU: 4, ExpectedMaxRAM: 50}) | ||
tc.SetResourceLimits(testbed.ResourceSpec{ExpectedMaxCPU: 4, ExpectedMaxRAM: 55}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the GitHub Action runners the RAM utilization is consistently higher (probably due to some other background processes on the GitHub machine). Loadtests don't pass unless these values are adjusted a little 😞 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this increase enough? |
||
tc.StartAgent() | ||
|
||
tc.Sleep(tc.Duration) | ||
|
@@ -53,7 +53,7 @@ func TestBallastMemory(t *testing.T) { | |
ballastSize uint32 | ||
maxRSS uint32 | ||
}{ | ||
{100, 50}, | ||
{100, 60}, | ||
{500, 70}, | ||
{1000, 100}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadtestpre
does some pre-processing so we can simulate CircleCI testsharding on GitHub Actions. This cuts down the runtime of loadtests from 15mins to ~5minsThis job does the following:
make testbed-list-loadtest
TestIdleMode|TestBallastMemory
,TestLog10kDPS|TestMetric10kDPS
etc)fromJSON()
. The strategy.matrix is how we get to run the loadtests in parallel