簡體   English   中英

Github Actions 監聽本地主機

[英]Github Actions listen on localhost

我正在嘗試為我的 go 項目設置自動測試覆蓋率分析,但是我無法讓它在 github 操作上運行,因為 go test 命令失敗並出現以下錯誤:

Run go test -race -coverprofile=coverage.txt -covermode=atomic ./...
go: downloading github.com/alyu/configparser v0.0.0-20191103060215-744e9a66e7bc
go: downloading gorm.io/driver/mysql v1.1.2
go: downloading gorm.io/driver/postgres v1.1.1
go: downloading gorm.io/driver/sqlite v1.1.5
go: downloading gorm.io/gorm v1.21.15
go: downloading gopkg.in/guregu/null.v4 v4.0.0
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/go-sql-driver/mysql v1.6.0
go: downloading github.com/jackc/pgx/v4 v4.13.0
go: downloading github.com/mattn/go-sqlite3 v1.14.8
go: downloading github.com/jinzhu/inflection v1.0.0
go: downloading github.com/jinzhu/now v1.1.2
go: downloading github.com/jackc/pgconn v1.10.0
go: downloading github.com/jackc/pgio v1.0.0
go: downloading github.com/jackc/pgproto3/v2 v2.1.1
go: downloading github.com/jackc/pgtype v1.8.1
go: downloading github.com/jackc/chunkreader/v2 v2.0.1
go: downloading github.com/jackc/pgpassfile v1.0.0
go: downloading github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: downloading golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
go: downloading golang.org/x/text v0.3.7
?       github.com/Zaprit/Reflow    [no test files]
?       github.com/Zaprit/Reflow/config [no test files]
?       github.com/Zaprit/Reflow/database   [no test files]
?       github.com/Zaprit/Reflow/internal   [no test files]
?       github.com/Zaprit/Reflow/models [no test files]
2021/10/24 21:59:38 Get "http://127.0.0.1:8069/api": dial tcp 127.0.0.1:8069: connect: connection refused
FAIL    github.com/Zaprit/Reflow/technicapi 0.049s
?       github.com/Zaprit/Reflow/utils  [no test files]
FAIL
Error: Process completed with exit code 1.

到目前為止,我已經嘗試強制測試在127.0.0.1上收聽,因為我認為這可能是由於 github 服務器上缺乏 IPV6 支持造成的,盡管這不起作用。

這是我用於測試的 CI 管道

# This lints the Reflow project

name: Lint

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Setup Go environment
        uses: actions/setup-go@v2.1.3
        with:
          go-version: 1.17.1
          stable: true
          token: ${{ github.token }}
      - name: Run golangci-lint
        uses: golangci/golangci-lint-action@v2.5.2

我修復了它,我猜這是端口的權限問題,因為我切換到服務器使用 net/http/httptest 並且它工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM