From 54e3a69d143eb71ba7b7738765e3ffd46b826a1d Mon Sep 17 00:00:00 2001 From: Anuj Singh <60409639+singholt@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:18:04 -0700 Subject: [PATCH 1/2] add go linter to linux workflow --- .github/workflows/linux.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 527fb295a31..f2047cec2e2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -28,3 +28,17 @@ jobs: cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent make test-silent make analyze-cover-profile + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest + From e4dee19f28db1aeaa0384f0fbb49c71f3aa8cff2 Mon Sep 17 00:00:00 2001 From: Anuj Singh Date: Wed, 22 Jun 2022 10:29:23 -0700 Subject: [PATCH 2/2] add working-directory to linter config --- .github/workflows/golangci-lint.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/linux.yml | 16 +--------------- 2 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/golangci-lint.yaml diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml new file mode 100644 index 00000000000..e88cab125db --- /dev/null +++ b/.github/workflows/golangci-lint.yaml @@ -0,0 +1,26 @@ +name: golangci-lint + +on: [pull_request] + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + path: src/github.com/aws/amazon-ecs-agent + - name: GO_VERSION + run: | + cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent + echo "GO_VERSION=$(cat GO_VERSION)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.42.1 + args: -v + skip-go-installation: true + only-new-issues: true \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f2047cec2e2..48066cdaeb0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -27,18 +27,4 @@ jobs: export GO111MODULE=auto cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent make test-silent - make analyze-cover-profile - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: latest - + make analyze-cover-profile \ No newline at end of file