fix: build test instead of unit test

This commit is contained in:
sagitchu
2025-03-18 21:22:18 +08:00
parent abdc98d718
commit 859dad5dc2

View File

@@ -22,26 +22,46 @@ on:
- 'main' - 'main'
jobs: jobs:
unit_tests: build_tests:
name: "Unit tests" name: "build tests"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with: with:
go-version: ^1.22 fetch-depth: 0
- name: Check repository URL
# When you execute your unit tests, make sure to use the "-coverprofile" flag to write a run: |
# coverage profile to a file. You will need the name of the file (e.g. "coverage.txt") REPO_URL=$(git config --get remote.origin.url)
# in the next step as well as the next job. if [[ $REPO_URL == *"pro" ]]; then
- name: Test exit 1
run: go test -cover -coverprofile=coverage.txt ./... fi
- uses: codecov/codecov-action@v4 - uses: actions/setup-node@v3
with: with:
token: ${{ secrets.CODECOV_TOKEN }} node-version: 16
- name: Build Frontend
env:
CI: ""
run: |
cd web
git describe --tags > VERSION
REACT_APP_VERSION=$(git describe --tags) chmod u+x ./build.sh && ./build.sh
cd ..
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.18.0'
- name: Build Backend (amd64)
run: |
go mod download
go build -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
- name: Build Backend (arm64)
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64
commit_lint: commit_lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest