From 00c6fb8c1db58abab2fdec3bf5a629821d3a4cfd Mon Sep 17 00:00:00 2001 From: Mikhail Grachev Date: Wed, 14 Jul 2021 12:28:18 +0300 Subject: [PATCH] Move linters to GH Actions Signed-off-by: Mikhail Grachev --- .circleci/bin/install.sh | 22 ---------- .circleci/bin/reviewdog_dotenv.sh | 7 --- .circleci/bin/reviewdog_golangci-lint.sh | 7 --- .circleci/bin/reviewdog_hadolint.sh | 7 --- .circleci/config.yml | 31 -------------- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 74 deletions(-) delete mode 100755 .circleci/bin/install.sh delete mode 100755 .circleci/bin/reviewdog_dotenv.sh delete mode 100755 .circleci/bin/reviewdog_golangci-lint.sh delete mode 100755 .circleci/bin/reviewdog_hadolint.sh create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/bin/install.sh b/.circleci/bin/install.sh deleted file mode 100755 index 6fd66ba4..00000000 --- a/.circleci/bin/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -REVIEWDOG_VERSION=v0.11.0 -GOLANGCILINT_VERSION=v1.37.1 -HADOLINT_VERSION=v1.22.1 -DOTENV_LINTER_VERSION=v3.0.0 - -# Install reviewdog -wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh \ - | sh -s -- -b ./bin $REVIEWDOG_VERSION - -# Install golangci-lint -wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $GOLANGCILINT_VERSION - -# Install hadolint -wget -q https://github.com/hadolint/hadolint/releases/download/$HADOLINT_VERSION/hadolint-Linux-x86_64 \ - -O ./bin/hadolint && chmod +x ./bin/hadolint - -# Install dotenv-linter -wget -q -O - https://git.io/JLbXn | sh -s -- -b bin $DOTENV_LINTER_VERSION \ No newline at end of file diff --git a/.circleci/bin/reviewdog_dotenv.sh b/.circleci/bin/reviewdog_dotenv.sh deleted file mode 100755 index 04aa1bb2..00000000 --- a/.circleci/bin/reviewdog_dotenv.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -# Exit code always 0 -dotenv-linter \ -| reviewdog -f=dotenv-linter -diff="git diff ${DEFAULT_BRANCH}..HEAD" -reporter=github-pr-review diff --git a/.circleci/bin/reviewdog_golangci-lint.sh b/.circleci/bin/reviewdog_golangci-lint.sh deleted file mode 100755 index c199073c..00000000 --- a/.circleci/bin/reviewdog_golangci-lint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -# Exit code always 0 -golangci-lint run --out-format=line-number \ -| reviewdog -f=golangci-lint -diff="git diff ${DEFAULT_BRANCH}..HEAD" -reporter=github-pr-review diff --git a/.circleci/bin/reviewdog_hadolint.sh b/.circleci/bin/reviewdog_hadolint.sh deleted file mode 100755 index 7980d0af..00000000 --- a/.circleci/bin/reviewdog_hadolint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -# Exit code always 0 -git ls-files --exclude='Dockerfile*' --ignored | xargs hadolint \ -| reviewdog -efm="%f:%l %m" -diff="git diff ${DEFAULT_BRANCH}..HEAD" -reporter=github-pr-review diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d44c4ac..f47e258d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,36 +28,6 @@ aliases: - "/go/pkg/mod" jobs: - linters: - executor: - name: default - steps: - - checkout - - run: - name: Install tools - command: .circleci/bin/install.sh - - run: - name: PATH for working without a relative path - command: echo "export PATH=$PATH:/home/circleci/project/bin" >> $BASH_ENV - - run: - name: Dotenv > Reviewdog - command: .circleci/bin/reviewdog_dotenv.sh - - run: - name: Hadolint > Reviewdog - command: .circleci/bin/reviewdog_hadolint.sh - - run: - name: Golangci-lint > Reviewdog - command: .circleci/bin/reviewdog_golangci-lint.sh - - run: - name: Dotenv - command: dotenv-linter - - run: - name: Hadolint - command: git ls-files --exclude='Dockerfile*' --ignored | xargs hadolint - - run: - name: Golangci-lint - command: golangci-lint run - tests: executor: name: default @@ -83,6 +53,5 @@ jobs: workflows: ci: jobs: - - linters - tests - integration-tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..03723909 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI +on: pull_request + +jobs: + golangci-lint: + name: runner / golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v1 + + misspell: + name: runner / misspell + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-misspell@v1 + with: + locale: "US" + fail_on_error: true + + yamllint: + name: runner / yamllint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-yamllint@v1 + with: + fail_on_error: true + reporter: github-pr-review + yamllint_flags: '-d "{extends: default, rules: {truthy: disable}}" .' + + hadolint: + name: runner / hadolint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-hadolint@v1 + with: + fail_on_error: true + reporter: github-pr-review + + dotenv-linter: + name: runner / dotenv-linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dotenv-linter/action-dotenv-linter@v2 + with: + reporter: github-pr-review