Skip to content

Commit

Permalink
Update the test flow
Browse files Browse the repository at this point in the history
  • Loading branch information
0Tech committed Aug 10, 2022
1 parent 72fb3c2 commit 5d2e0c8
Showing 1 changed file with 59 additions and 62 deletions.
121 changes: 59 additions & 62 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
push:
branches:
- main
- develop

jobs:
cleanup-runs:
Expand All @@ -15,20 +14,20 @@ jobs:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"

install-tparse:
runs-on: self-hosted
steps:
- uses: actions/setup-go@v2.1.3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- name: install tparse
run: |
export GO111MODULE="on" && go get github.com/mfridman/tparse@v0.8.3
- uses: actions/cache@v2.1.3
export GO111MODULE="on" && go install github.com/mfridman/tparse@v0.8.3
- uses: actions/cache@v3.0.5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
Expand All @@ -39,45 +38,45 @@ jobs:
matrix:
go-arch: ["amd64"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
- uses: technote-space/get-diff-action@v4
id: git_diff
go-version: 1.18
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
if: env.GIT_DIFF

split-test-files:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Create a file with all the pkgs
run: go list ./... > pkgs.txt
- name: Split pkgs into 4 files
run: split -d -n l/4 pkgs.txt pkgs.txt.part.
# cache multiple
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-00"
path: ./pkgs.txt.part.00
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-01"
path: ./pkgs.txt.part.01
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-02"
path: ./pkgs.txt.part.02
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-03"
path: ./pkgs.txt.part.03
Expand All @@ -90,25 +89,25 @@ jobs:
matrix:
part: ["00", "01", "02", "03"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
- uses: technote-space/get-diff-action@v4
go-version: 1.18
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock goleveldb'
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}profile.out
Expand All @@ -117,26 +116,26 @@ jobs:
runs-on: self-hosted
needs: tests
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-coverage"
if: env.GIT_DIFF
Expand All @@ -155,7 +154,7 @@ jobs:
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: env.GIT_DIFF
- uses: codecov/codecov-action@v1.5.0
- uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
Expand All @@ -169,25 +168,25 @@ jobs:
matrix:
part: ["00", "01", "02", "03"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
- uses: technote-space/get-diff-action@v4
go-version: 1.18
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -tags='cli_test goleveldb' | tee ${{ matrix.part }}-integration-output.txt
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-integration-output"
path: ./${{ matrix.part }}-integration-output.txt
Expand All @@ -197,31 +196,30 @@ jobs:
needs: [test-integration, install-tparse]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
id: git_diff
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-integration-output"
if: env.GIT_DIFF
- uses: actions/cache@v2.1.3
- uses: actions/cache@v3.0.5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
Expand All @@ -238,25 +236,25 @@ jobs:
matrix:
part: ["00", "01", "02", "03"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
- uses: technote-space/get-diff-action@v4
go-version: 1.18
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test report creation
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -tags='cli_multi_node_test goleveldb' | tee ${{ matrix.part }}-integration-multi-node-output.txt
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-integration-multi-node-output"
path: ./${{ matrix.part }}-integration-multi-node-output.txt
Expand All @@ -266,31 +264,30 @@ jobs:
needs: [test-integration-multi-node, install-tparse]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
id: git_diff
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/cache@v2.1.3
- uses: actions/cache@v3.0.5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
Expand All @@ -303,10 +300,10 @@ jobs:
runs-on: self-hosted
needs: [build, tests]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Start localnet
run: |
make localnet-start
Expand Down

0 comments on commit 5d2e0c8

Please sign in to comment.