Files
gaze-indexer/.github/workflows/code-analysis.yml
waiemwor db5dc75c41 Feature/nodesale (#40)
* feat: recover nodesale module.

* fix: refactored.

* fix: fix table type.

* fix: add entity

* fix: bug UTC time.

* ci: try to tidy before testing

* ci: touch result file

* ci: use echo to create new file

* fix: try to skip test in ci

* fix: remove os.Exit

* fix: handle error

* feat: add todo note

* fix: Cannot run nodesale test because qtx is not initiated.

* fix: 50% chance public key compare incorrectly.

* fix: more consistent SQL

* fix: sanity refactor.

* fix: remove unused code.

* fix: move last_block_default to config file.

* fix: minor mistakes.

* fix:

* fix: refactor

* fix: refactor

* fix: delegate tx hash not record into db.

* refactor: prepare for moving integration tests.

* refactor: convert to unit tests.

* fix: change to using input values since output values deducted fee.

* feat: add extra unit test.

* fix: wrong timestamp format.

* fix: handle block timeout = 0

---------

Co-authored-by: Gaze <gazenw@users.noreply.github.com>
2024-08-05 11:33:20 +07:00

81 lines
2.1 KiB
YAML

name: Code Analysis & Test
on:
workflow_dispatch:
pull_request:
branches:
- develop
- main
paths:
- "go.mod"
- "go.sum"
- "**.go"
- ".golangci.yaml"
- ".github/workflows/code-analysis.yml"
jobs:
lint:
strategy:
matrix:
os: ["ubuntu-latest"]
name: Lint (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true # caching and restoring go modules and build outputs.
- name: Lint
uses: reviewdog/action-golangci-lint@v2
with: # https://github.com/reviewdog/action-golangci-lint#inputs
go_version_file: "go.mod"
workdir: ./
golangci_lint_flags: "--config=./.golangci.yaml --verbose --new-from-rev=${{ github.event.pull_request.base.sha }}"
fail_on_error: true
test:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
go-version: ["1.22.x", "1.x"] # minimum version and latest version
name: Test (${{ matrix.os }}/${{ matrix.go-version }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true # caching and restoring go modules and build outputs.
- run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
- name: Touch test result file
run: echo "" > test_output.json
- name: Build
run: go build -v ./...
- name: Test
run: go test -json ./... > test_output.json
- name: Summary Test Results
if: always()
uses: robherley/go-test-action@v0
with:
fromJSONFile: test_output.json
- name: Annotate Test Results
if: always()
uses: guyarb/golang-test-annotations@v0.5.1
with:
test-results: test_output.json