Skip to content

Commit

Permalink
CI: move deps and lint jobs only on pull requests
Browse files Browse the repository at this point in the history
This war provoked as the new use of golangci-lint action fails on master
with all the lint errors there. But in reality it's probably not needed
to run those tasks on master - they are mostly about new code
  • Loading branch information
mstoykov committed Feb 28, 2022
1 parent cdccc9b commit e663b75
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 42 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,6 @@ env:
GHCR_IMAGE_ID: ${{ github.repository }}

jobs:
deps:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Check dependencies
run: |
go version
test -z "$(go mod tidy && go mod vendor && git status --porcelain)"
go mod verify
- name: Check code generation
run: |
go install github.com/alvaroloes/[email protected]
go install github.com/mailru/easyjson/[email protected]
test -z "$(go generate ./... && git status --porcelain)"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Retrieve golangci-lint version
run: |
echo "::set-output name=Version::$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')"
id: version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: ${{ steps.version.outputs.Version }}
only-new-issues: true

test-prev:
strategy:
fail-fast: false
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Lint
on:
# Enable manually triggering this workflow via the API or web UI
workflow_dispatch:
pull_request:

defaults:
run:
shell: bash

jobs:
deps:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Check dependencies
run: |
go version
test -z "$(go mod tidy && go mod vendor && git status --porcelain)"
go mod verify
- name: Check code generation
run: |
go install github.com/alvaroloes/[email protected]
go install github.com/mailru/easyjson/[email protected]
test -z "$(go generate ./... && git status --porcelain)"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Retrieve golangci-lint version
run: |
echo "::set-output name=Version::$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')"
id: version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: ${{ steps.version.outputs.Version }}
only-new-issues: true

0 comments on commit e663b75

Please sign in to comment.