Skip to content

Commit

Permalink
CI: move deps and lint jobs only on pull requests (#2403)
Browse files Browse the repository at this point in the history
This was 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

This also drop deps and lint from the requirements to build packages
  • Loading branch information
mstoykov committed Mar 1, 2022
1 parent cdccc9b commit fb57be0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 46 deletions.
50 changes: 4 additions & 46 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/enumer@v1.1.2
go install github.com/mailru/easyjson/easyjson@v0.7.7
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 Expand Up @@ -186,7 +144,7 @@ jobs:
build:
runs-on: ubuntu-latest
needs: [configure, deps, lint, test-current-cov]
needs: [configure, test-current-cov]
if: startsWith(github.ref, 'refs/tags/v')
env:
VERSION: ${{ needs.configure.outputs.version }}
Expand Down Expand Up @@ -247,7 +205,7 @@ jobs:

build-docker:
runs-on: ubuntu-latest
needs: [deps, lint, test-current-cov, configure]
needs: [test-current-cov, configure]
env:
VERSION: ${{ needs.configure.outputs.version }}
steps:
Expand Down Expand Up @@ -309,7 +267,7 @@ jobs:
defaults:
run:
shell: powershell
needs: [deps, lint, test-current-cov, configure, build]
needs: [test-current-cov, configure, build]
if: startsWith(github.ref, 'refs/tags/v')
env:
VERSION: ${{ needs.configure.outputs.version }}
Expand Down Expand Up @@ -396,7 +354,7 @@ jobs:

publish-github:
runs-on: ubuntu-latest
needs: [configure, deps, lint, test-current-cov, build, package-windows]
needs: [configure, test-current-cov, build, package-windows]
if: startsWith(github.ref, 'refs/tags/v')
env:
VERSION: ${{ needs.configure.outputs.version }}
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/enumer@v1.1.2
go install github.com/mailru/easyjson/easyjson@v0.7.7
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 fb57be0

Please sign in to comment.