Skip to content

chore: introduce .github #6

chore: introduce .github

chore: introduce .github #6

Workflow file for this run

name: mev-commit-ci
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache Modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
**/go.work.sum # Add this line to include go.work.sum in the cache path
key: ${{ runner.os }}-go-${{ hashFiles('**/go.work.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Workspace Modules
run: |
echo "GO_WORKSPACE_MODULES=$(go list -f '{{.Dir}}' -m)" >> $GITHUB_ENV
echo ${{ env.GO_WORKSPACE_MODULES }}
- name: Tidy
run: go list -f '{{.Dir}}' -m | xargs -L1 go mod tidy -C
- name: Sync
run: go work sync
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
only-new-issues: true
args: --timeout 5m ${{ env.GO_WORKSPACE_MODULES }}
- name: Build
run: go list -f '{{.Dir}}/...' -m | xargs go build
- name: Test
run: go list -f '{{.Dir}}/...' -m | xargs go test -v