ci: separate out PR tests and run fuzzing and race in nightlies #1919
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | ||
on: | ||
workflow_call: | ||
env: | ||
GO_VERSION: '1.21.1' | ||
jobs: | ||
split-test-files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
check-latest: true | ||
- name: Create a file with all Celestia pkgs | ||
run: go list ./... > pkgs.txt | ||
- name: Split pkgs into 4 files | ||
run: split -d -n l/4 pkgs.txt pkgs.txt.part. | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ github.sha }}-00" | ||
path: ./pkgs.txt.part.00 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ github.sha }}-01" | ||
path: ./pkgs.txt.part.01 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ github.sha }}-02" | ||
path: ./pkgs.txt.part.02 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ github.sha }}-03" | ||
path: ./pkgs.txt.part.03 | ||
tests: | ||
runs-on: ubuntu-latest | ||
needs: split-test-files | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
part: ["00", "01", "02", "03"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
check-latest: true | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- uses: technote-space/[email protected] | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/*.go | ||
go.mod | ||
go.sum | ||
**/go.mod | ||
**/go.sum | ||
Makefile | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: "${{ github.sha }}-${{ matrix.part }}" | ||
- name: test & coverage report creation | ||
if: env.GIT_DIFF | ||
run: | | ||
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic | ||
- uses: actions/upload-artifact@v3 | ||
if: env.GIT_DIFF | ||
with: | ||
name: "${{ github.sha }}-${{ matrix.part }}-coverage" | ||
path: ./${{ matrix.part }}profile.out | ||