mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
refactor: organize Go packages and remove test files
Move the command to cmd/opencode2api and group production code into configuration, gateway, protocol, model, admin, telemetry and helper packages. Keep shared state private behind context, metrics and runtime interfaces. Remove the requested test files and replace test-only CI jobs with vet/build checks. Update Docker and release build paths, preserve version injection and make the WebUI an explicit embedded asset package. Add directory trees and source reading guides to both READMEs. Anchor binary ignore rules so the command package is tracked.
This commit is contained in:
1 parent
28474f8702
commit
46def7fedc
59 files changed
+1808
-2894
No files matched your search
@@ -14,7 +14,7 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
build:
|
||||
name: Go ${{ matrix.go }} / ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@@ -30,14 +30,8 @@ jobs:
|
||||
cache: true
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
- name: Test with race detection
|
||||
if: runner.os == 'Linux'
|
||||
run: go test -race -coverprofile=coverage.out ./...
|
||||
- name: Test on Windows
|
||||
if: runner.os == 'Windows'
|
||||
run: go test ./...
|
||||
- name: Build
|
||||
run: go build ./...
|
||||
run: go build -trimpath ./cmd/opencode2api
|
||||
|
||||
format:
|
||||
name: Formatting and WebUI syntax
|
||||
|
||||
@@ -44,8 +44,8 @@ jobs:
|
||||
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "image_name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
test:
|
||||
name: Test
|
||||
verify:
|
||||
name: Verify source
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source
|
||||
@@ -57,12 +57,15 @@ jobs:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./...
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Build
|
||||
run: go build ./...
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
|
||||
needs: [prepare, test]
|
||||
needs: [prepare, verify]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -124,7 +127,7 @@ jobs:
|
||||
ARCHIVE_FORMAT: ${{ matrix.archive }}
|
||||
run: |
|
||||
mkdir -p "dist/$PACKAGE_NAME"
|
||||
go build -trimpath -ldflags="-s -w -X main.version=$RELEASE_TAG" -o "dist/$PACKAGE_NAME/opencode2api$EXTENSION" ./
|
||||
go build -trimpath -ldflags="-s -w -X main.version=$RELEASE_TAG" -o "dist/$PACKAGE_NAME/opencode2api$EXTENSION" ./cmd/opencode2api
|
||||
cp README.md README.zh-CN.md config.example.json "dist/$PACKAGE_NAME/"
|
||||
if [[ "$ARCHIVE_FORMAT" == "zip" ]]; then
|
||||
(cd dist && zip -q -r "$PACKAGE_NAME.zip" "$PACKAGE_NAME")
|
||||
@@ -146,7 +149,7 @@ jobs:
|
||||
|
||||
container:
|
||||
name: Publish GHCR image
|
||||
needs: [prepare, test]
|
||||
needs: [prepare, verify]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in new issue
Block a user