ci: move test execution to makefile (#7372) (#7374)

(cherry picked from commit b3be1d7d7a)
This commit is contained in:
Sam Kleinman
2021-12-02 17:25:13 -05:00
committed by GitHub
parent b4396d79f2
commit 9978a3c99b
2 changed files with 26 additions and 39 deletions

View File

@@ -9,32 +9,6 @@ on:
- release/**
jobs:
split-test-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- 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
with:
name: "${{ github.sha }}-00"
path: ./pkgs.txt.part.00
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-01"
path: ./pkgs.txt.part.01
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-02"
path: ./pkgs.txt.part.02
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-03"
path: ./pkgs.txt.part.03
build-linux:
name: Build
runs-on: ubuntu-latest
@@ -55,13 +29,13 @@ jobs:
"!test/"
go.mod
go.sum
Makefile
- name: install
run: GOOS=linux GOARCH=${{ matrix.goarch }} make build
if: "env.GIT_DIFF != ''"
tests:
runs-on: ubuntu-latest
needs: split-test-files
strategy:
fail-fast: false
matrix:
@@ -78,22 +52,15 @@ jobs:
"!test/"
go.mod
go.sum
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
Makefile
- name: test & coverage report creation
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 8m -race -coverprofile=${{ matrix.part }}profile.out
make test-group-${{ matrix.part }} NUM_SPLIT=4
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}profile.out
path: ./build/${{ matrix.part }}.profile.out
upload-coverage-report:
runs-on: ubuntu-latest
@@ -107,6 +74,7 @@ jobs:
"!test/"
go.mod
go.sum
Makefile
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-00-coverage"