From 21af46b7bccfe5ae76c2e50e763eadb50eab737f Mon Sep 17 00:00:00 2001 From: JoeGruff Date: Fri, 26 Apr 2024 11:13:57 +0900 Subject: [PATCH] goci: Add back linters. --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ asset/dcr/log.go | 2 +- asset/dcr/wallet.go | 2 +- cgo/cgo.go | 2 +- cgo/walletloader.go | 2 +- 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7a31b37 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build and Test +on: [push, pull_request] +permissions: + contents: read +jobs: + build-go: + name: Go CI + runs-on: ubuntu-latest + strategy: + matrix: + go: ['1.20', '1.21'] + steps: + - uses: awalsh128/cache-apt-pkgs-action@1850ee53f6e706525805321a3f2f863dcf73c962 #v1.3.0 + with: + packages: git-restore-mtime libgtk-3-dev libwebkit2gtk-4.0-dev + version: 1.0 + + - name: Set up Go + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe #v4.1.0 + with: + go-version: ${{ matrix.go }} + + - name: Check out source + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 + with: + fetch-depth: 0 + # Restore original file modification times for test cache reasons + - name: restore timestamps + run: git restore-mtime + - name: Install Linters + run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2" + - name: Use test and module cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: go-test-${{ matrix.go }}-${{ github.sha }} + restore-keys: go-test-${{ matrix.go }} + + - name: Test + env: + GO111MODULE: "on" + run: | + ./run_tests.sh + + lint-docs: + name: Lint Markdown + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 + - uses: DavidAnson/markdownlint-cli2-action@3aaa38e446fbd2c288af4291aa0f55d64651050f #v12.0.0 + continue-on-error: true + with: + globs: | + *.md diff --git a/asset/dcr/log.go b/asset/dcr/log.go index 91ab709..a707218 100644 --- a/asset/dcr/log.go +++ b/asset/dcr/log.go @@ -10,8 +10,8 @@ import ( "decred.org/dcrwallet/v3/wallet" "decred.org/dcrwallet/v3/wallet/udb" "github.com/decred/dcrd/connmgr/v3" - "github.com/decred/slog" "github.com/decred/libwallet/assetlog" + "github.com/decred/slog" ) // loggingInited will be set when the log rotator has been initialized. diff --git a/asset/dcr/wallet.go b/asset/dcr/wallet.go index e039fc0..f22b156 100644 --- a/asset/dcr/wallet.go +++ b/asset/dcr/wallet.go @@ -8,8 +8,8 @@ import ( "decred.org/dcrwallet/v3/spv" "decred.org/dcrwallet/v3/wallet" "github.com/decred/dcrd/chaincfg/v3" - "github.com/decred/slog" "github.com/decred/libwallet/asset" + "github.com/decred/slog" ) type mainWallet = wallet.Wallet diff --git a/cgo/cgo.go b/cgo/cgo.go index 542416e..5585641 100644 --- a/cgo/cgo.go +++ b/cgo/cgo.go @@ -13,9 +13,9 @@ import ( "context" "sync" - "github.com/decred/slog" "github.com/decred/libwallet/asset/dcr" "github.com/decred/libwallet/assetlog" + "github.com/decred/slog" ) var ( diff --git a/cgo/walletloader.go b/cgo/walletloader.go index 9bc5cd5..5553cec 100644 --- a/cgo/walletloader.go +++ b/cgo/walletloader.go @@ -7,9 +7,9 @@ import ( "sync" "decred.org/dcrdex/client/mnemonic" - "github.com/decred/slog" "github.com/decred/libwallet/asset" "github.com/decred/libwallet/asset/dcr" + "github.com/decred/slog" ) const emptyJsonObject = "{}"