diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..d992bc6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Lint + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + lint_go: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + + - name: Check Go code formatting + run: test -z $(goimports -l .) + + lint_sol: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup NodeJs + uses: actions/setup-node@v2 + with: + node-version: 14.x + + - name: Cache dependencies + id: cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: modules-${{ hashFiles('package-lock.json') }} + + - name: Install npm dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts + + - name: Check Solidity code formatting + run: npx prettier '**/*.sol' --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77f6961..b0a3db9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,9 +41,3 @@ jobs: - name: Run tests run: npm run testverbose - - - name: Check solidity code style - run: npx prettier '**/*.sol' --check - - - name: Check go code style - run: test -z $(gofmt -l .) diff --git a/README.md b/README.md index d1fab8a..69cf870 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![testing](https://github.com/divergencetech/ethier/actions/workflows/test.yml/badge.svg) +![lint](https://github.com/divergencetech/ethier/actions/workflows/lint.yml/badge.svg) # Motivation diff --git a/package.json b/package.json index e2aab6d..026f9ad 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "build": "go build -o build/ethier ethier/*.go", "generate": "PATH=\"$(readlink -f build):${PATH}\" go generate ./...", "testlight": "go test ./...", - "test": "go generate ./... && go test ./...", - "testverbose": "go generate ./... && go test ./... -test.v" + "test": "PATH=\"$(readlink -f build):${PATH}\" go generate ./... && go test ./...", + "testverbose": "PATH=\"$(readlink -f build):${PATH}\" go generate ./... && go test ./... -test.v" }, "repository": { "type": "git", @@ -25,4 +25,4 @@ "prettier": "^2.5.1", "prettier-plugin-solidity": "^1.0.0-beta.19" } -} +} \ No newline at end of file