diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9bf428168..a06fed555 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,19 +7,6 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 12 - - name: Install Dependencies - run: npm ci - - name: Run check - run: npm run check - - name: Run test - run: npm t - - name: Run lint - run: npm run lint - - name: Set up Go 1.17 uses: actions/setup-go@v2 with: @@ -29,5 +16,5 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Run check (sanity only) - run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=sanity-check + - name: Run check + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=checker \ No newline at end of file diff --git a/.github/workflows/fix-dryrun.yml b/.github/workflows/fix-dryrun.yml index 41b388cd0..c0ad2c120 100644 --- a/.github/workflows/fix-dryrun.yml +++ b/.github/workflows/fix-dryrun.yml @@ -1,24 +1,28 @@ -name: Fixes (sanity and consistency) - Dry run +name: Fix (Dry run) on: pull_request: - branches: [master] + branches: master + jobs: - fix-all-dryrun: + fix-dryrun: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - name: Set up Go 1.17 + uses: actions/setup-go@v2 with: - node-version: 12 - - name: Install Dependencies - run: npm ci - - name: Run fix script - run: npm run fix - - name: Show fix result (diff); run 'npm run fix' locally + go-version: 1.17 + id: go + + - name: Check out code + uses: actions/checkout@v2 + + - name: Run fix + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=fixer + + - name: Show fix result (diff) run: | git status git diff + - name: Run check - run: npm run check - - name: Run test - run: npm t + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=checker \ No newline at end of file diff --git a/.github/workflows/periodic-update.yml b/.github/workflows/periodic-update.yml index eb34893ce..2b95b16f5 100644 --- a/.github/workflows/periodic-update.yml +++ b/.github/workflows/periodic-update.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v2 - name: Run update auto - run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=update-auto + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=updater-auto - name: Show update result (diff) if: success() @@ -32,7 +32,7 @@ jobs: git diff - name: Run check - run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=sanity-check + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=checker - name: Commit changes if: success() diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 41eaa1f9d..77dd09f8f 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -20,5 +20,5 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Run check (sanity only) - run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=sanity-check \ No newline at end of file + - name: Run check + run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=checker \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index b2ce9fc71..433ddf551 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -2,7 +2,6 @@ package main import ( "flag" - "os" log "github.com/sirupsen/logrus" @@ -10,7 +9,6 @@ import ( "github.com/trustwallet/assets-go-libs/src/config" "github.com/trustwallet/assets-go-libs/src/core" "github.com/trustwallet/assets-go-libs/src/processor" - "github.com/trustwallet/assets-go-libs/src/reporter" ) var ( @@ -27,13 +25,14 @@ func main() { fileStorage := file.NewService() validatorsService := core.NewService(fileStorage) - reportService := reporter.NewReportService() - assetfsProcessor := processor.NewService(fileStorage, validatorsService, reportService) + assetfsProcessor := processor.NewService(fileStorage, validatorsService) switch script { - case "sanity-check": - err = assetfsProcessor.RunSanityCheck(paths) - case "update-auto": + case "checker": + err = assetfsProcessor.RunJob(paths, assetfsProcessor.Check) + case "fixer": + err = assetfsProcessor.RunJob(paths, assetfsProcessor.Fix) + case "updater-auto": err = assetfsProcessor.RunUpdateAuto() default: log.Error("Nothing to launch. Use --script flag to choose a script to run.") @@ -42,21 +41,6 @@ func main() { if err != nil { log.WithError(err).Error() } - - reports := reportService.GetReports() - for key, report := range reports { - log.WithFields(log.Fields{ - "total_files": report.TotalFiles, - "errors": report.Errors, - "warnings": report.Warnings, - "fixed": report.Fixed, - }).Info(key) - - if report.Errors > 0 { - os.Exit(1) - } - } - } func setup() { diff --git a/go.mod b/go.mod index b366c13bf..c778b69a2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/sirupsen/logrus v1.8.1 - github.com/trustwallet/assets-go-libs v0.0.11 + github.com/trustwallet/assets-go-libs v0.0.12-0.20211211200802-4ccd693c8b08 ) require ( diff --git a/go.sum b/go.sum index 61c21f743..b4bc8ae2d 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,14 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/trustwallet/assets-go-libs v0.0.11 h1:r1fLiHTYrzA38xCPmcW3PU0Mr2wRgSl/E/NKXIlHhfE= -github.com/trustwallet/assets-go-libs v0.0.11/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211210154426-b38f9a1b5ad5 h1:YSRZYJq5cYa58ZWbjqaJL0LASrx0kbCkjF68lf0lIac= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211210154426-b38f9a1b5ad5/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211195553-bf00b6d5a687 h1:eeBJ06PPaybsyG+kIJ1gSDgCUnRROcQor1XAX7ZtxiY= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211195553-bf00b6d5a687/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211195751-c5d6cf4e6b74 h1:A1w3epAenNWpY3eO/cGAObLhbHBJ9EWutBYk4Ox3VtY= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211195751-c5d6cf4e6b74/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211200802-4ccd693c8b08 h1:rWCyIa7S0nLZQIGbiWkJ0F018VD2lJ/AzAs8wzaFAyc= +github.com/trustwallet/assets-go-libs v0.0.12-0.20211211200802-4ccd693c8b08/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc= github.com/trustwallet/go-libs v0.2.20 h1:pYstFNgsc7CVyVeYt5GHsMa0JNQHJVRvPQqMvXMpCtY= github.com/trustwallet/go-libs v0.2.20/go.mod h1:7QdAp1lcteKKI0DYqGoaO8KO4eTNYjGmg8vHy0YXkKc= github.com/trustwallet/go-primitives v0.0.17 h1:1fBxZMKGCHdHtgdUzsqdFlD21+1GneIk/sxN6jxYBds=