Reviewed-on: #11 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, go_migr ]
|
|
pull_request:
|
|
branches: [ main, go_migr ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04 # You can change this to macos-latest or windows-latest if needed
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '1.24.6' # You can specify a specific version or 'stable'
|
|
|
|
- name: Build
|
|
run: |
|
|
go build -v -ldflags "\
|
|
-X main.version=${{ github.ref_name }} \
|
|
-X main.commit=${{ github.sha }} \
|
|
-X main.date=$(date +%Y-%m-%dT%H:%M:%S%z)" \
|
|
-o clean_file
|
|
|
|
- name: Test
|
|
run: go test -v ./...
|
|
|
|
- name: Run gofmt (optional)
|
|
# Uncomment to check code formatting with gofmt
|
|
run: |
|
|
if [ -n "$(gofmt -l.)" ]; then
|
|
echo "Go code is not formatted. Please run 'gofmt -w.' to fix it."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run golint (optional)
|
|
# Uncomment to check code style with golint
|
|
run: |
|
|
if [ -n "$(golint./...)" ]; then
|
|
echo "Go code has style issues. Please run 'golint./...' to see them."
|
|
exit 1
|
|
fi
|