mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-19 01:56:37 +08:00
ci: refactor GitHub Actions workflow to include Go Vet and test jobs
This commit is contained in:
parent
3e432c77bd
commit
53b7ef4bc6
48
.github/workflows/pr.yml
vendored
48
.github/workflows/pr.yml
vendored
@ -7,29 +7,39 @@ on:
|
|||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_latest:
|
go_vet:
|
||||||
|
name: Go Vet
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Go
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: actions/setup-go@v5
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
go-version: "1.24.0"
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: try to build
|
- name: Run go vet
|
||||||
uses: docker/build-push-action@v5
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: Run staticcheck
|
||||||
|
uses: dominikh/staticcheck-action@v1.3.0
|
||||||
with:
|
with:
|
||||||
context: .
|
version: "latest"
|
||||||
push: false
|
install-go: false
|
||||||
tags: ppcelery/one-api:pr
|
|
||||||
cache-from: type=gha
|
test:
|
||||||
cache-to: type=gha,mode=max
|
name: Run Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: go_vet
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.24.0"
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -race -v ./...
|
||||||
|
Loading…
Reference in New Issue
Block a user