Skip to content

Commit

Permalink
ci: separate out PR tests and run fuzzing and race in nightlies
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Oct 12, 2023
1 parent dcb10cf commit fcbc24e
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 51 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: nightly
on:
workflow_dispatch:
schedule:
# runs every day at 6am UTC
- cron: "0 6 * * *"
Expand All @@ -26,3 +27,26 @@ jobs:
- name: Run e2e tests
run: make test-e2e

race-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run tests in race mode
run: make test-race

fuzz_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: jidicula/go-fuzz-action@v1.1.0
with:
packages: './...'
fuzz-time: 2m
go-version: ${{ env.GO_VERSION }}
116 changes: 65 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,70 @@ env:
GO_VERSION: '1.21.1'

jobs:
test-short:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
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/get-diff-action@v6.1.2
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

- name: Run tests in short mode
run: make test-short
timeout-minutes: 10

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Run tests
run: make test

test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Generate coverage.txt
run: make test-coverage

- name: Upload coverage.txt
uses: codecov/codecov-action@v3.1.4
with:
file: ./coverage.txt

test-race:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Run tests in race mode
run: make test-race

0 comments on commit fcbc24e

Please sign in to comment.