Skip to content

Merge pull request #35 from farbodahm/feature/delayed-primary-stream #98

Merge pull request #35 from farbodahm/feature/delayed-primary-stream

Merge pull request #35 from farbodahm/feature/delayed-primary-stream #98

Workflow file for this run

name: Go Tests and Format
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
go:
name: Go ${{ matrix.task }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
strategy:
matrix:
task: [fmt, test, benchmark]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "^1.22.1"
- name: Install environment dependencies
run: sudo apt install graphviz # required for pprof
- name: Install Go dependencies
run: go mod tidy
# jobs
- name: Run go fmt
if: matrix.task == 'fmt'
run: |
if [ -n "$(go fmt ./...)" ]; then
echo "Go files must be formatted with gofmt."
exit 1
fi
- name: Run go test
if: matrix.task == 'test'
run: go test -v ./...
- name: Take benchmarks
if: matrix.task == 'benchmark'
run: bash ./benchmarks/take_benchmarks.sh
# Upload benchmark artifacts
- name: Upload benchmark artifacts
if: matrix.task == 'benchmark'
uses: actions/upload-artifact@v4
with:
name: benchmark-report
path: benchmarks/*.svg
retention-days: 30
# Comment benchmark duration as comment under PR
- name: Upload benchmark duration as comment
if: github.event_name == 'pull_request' && matrix.task == 'benchmark'
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
filePath: benchmark_duration.txt