45 lines
996 B
YAML
45 lines
996 B
YAML
name: Go build
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: https://gitea.com/actions/setup-go@v3
|
|
with:
|
|
go-version: 1.21
|
|
go111mode: on
|
|
goproxy: https://goproxy.cn,direct
|
|
|
|
- name: Build project
|
|
run: |
|
|
go build -v ./...
|
|
- name: Test with the Go CLI
|
|
run: go test
|
|
|
|
docker:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: https://gitea.com/docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t your-image-name:latest -f ./Dockerfile .
|
|
|
|
- name: Run Docker container
|
|
run: |
|
|
docker run -d -p 8080:8080 your-image-name:latest |