Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: move deps and lint jobs only on pull requests #2403

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[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 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/[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