- Fixed GitHub Actions CI workflow by setting the working directory to ./NewProxy - Added module caching to speed up dependency installation - Replaced 'go mod download' with 'go mod tidy' for automatic dependency resolution - Ensured all test and vet commands run inside the correct Go module directory - Resolved 'no modules specified' error during CI runs
45 lines
919 B
YAML
45 lines
919 B
YAML
name: Go CI - Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master, dev ]
|
|
pull_request:
|
|
branches: [ main, master, dev ]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./NewProxy
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Install dependencies
|
|
run: go mod tidy
|
|
|
|
- name: Run unit tests
|
|
run: go test ./... -v -cover
|
|
|
|
- name: Run vet & lint checks
|
|
run: |
|
|
go vet ./...
|
|
test -z "$(gofmt -l .)"
|