Skip to content

Fix syntax error in GitHub Actions workflow #5

Fix syntax error in GitHub Actions workflow

Fix syntax error in GitHub Actions workflow #5

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setting up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Check out code
uses: actions/checkout@v2
- name: Build
run: go build -v .
fmt:
name: Format Check
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Format
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "Unformatted files:"
echo "$unformatted"
exit 1
fi
test:
name: Test
runs-on: ubuntu-latest
needs: fmt
steps:
- name: Setting up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Check out code
uses: actions/checkout@v2
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: go test -v .