Skip to content

Commit

Permalink
Merge pull request PwPJ#2 from Hikikomori101/main
Browse files Browse the repository at this point in the history
test: Enhance CI with Build, Format Check, and Test Workflows for Go
  • Loading branch information
pouriya committed May 1, 2024
2 parents 6005ab9 + 086b8ba commit 635a0f0
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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: Format Check 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: Test
run: go test -v ./...

0 comments on commit 635a0f0

Please sign in to comment.