Skip to content

Commit

Permalink
moving loadtestpre into setup environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Azfaar Qureshi committed Dec 18, 2020
1 parent 46e2ce8 commit 71e2b1a
Showing 1 changed file with 23 additions and 45 deletions.
68 changes: 23 additions & 45 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ jobs:
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install tools
run: make install-tools
- 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"
- name: Upload tool binaries
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -125,55 +146,12 @@ 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"
loadtest:
runs-on: ubuntu-latest
needs: [setup-environment, loadtestpre]
needs: [setup-environment]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.loadtestpre.outputs.matrix) }}
matrix: ${{ fromJson(needs.setup-environment.outputs.matrix) }}
env:
TEST_RESULTS: testbed/tests/results/junit/results.xml
steps:
Expand Down

0 comments on commit 71e2b1a

Please sign in to comment.