mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 03:46:19 +08:00
ci/gha: convert lint-extra from a job to a step
There is no need to parallelize lint and lint-extra jobs, and they only differ with the arguments to golangci-lint. Given that the longest time spent in these jobs is installing libseccomp-dev, and that the second linter run can probably benefit a lot from caching, it makes sense to merge them. Move lint-extra from a separate job to a step in lint job. The implementation is motivated by [1] and relies on the fact that the last commit being fetched is the merge commit. So, we need to set fetch-depth to 2 to be able to see the diff of the merge commit -- and this is what golangci-lint is using. [1] https://github.com/golangci/golangci-lint-action/issues/449#issuecomment-1096995821 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
27
.github/workflows/validate.yml
vendored
27
.github/workflows/validate.yml
vendored
@@ -16,6 +16,8 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "${{ env.GO_VERSION }}"
|
go-version: "${{ env.GO_VERSION }}"
|
||||||
@@ -26,28 +28,11 @@ jobs:
|
|||||||
- uses: golangci/golangci-lint-action@v3
|
- uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
version: v1.45
|
version: v1.45
|
||||||
|
# Extra linters, only checking new code from a pull request.
|
||||||
lint-extra:
|
- name: lint-extra
|
||||||
# Extra linters, only checking new code from pull requests.
|
if: github.event_name == 'pull_request'
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: "${{ env.GO_VERSION }}"
|
|
||||||
- name: install deps
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt -q update
|
golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 --out-format=github-actions
|
||||||
sudo apt -q install libseccomp-dev
|
|
||||||
- uses: golangci/golangci-lint-action@v3
|
|
||||||
with:
|
|
||||||
only-new-issues: true
|
|
||||||
args: --config .golangci-extra.yml
|
|
||||||
version: v1.45
|
|
||||||
|
|
||||||
|
|
||||||
compile-buildtags:
|
compile-buildtags:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# This is golangci-lint config file which is used to check new code in
|
# This is golangci-lint config file which is used to check new code in
|
||||||
# github PRs only (see lint-extra job in .github/workflows/validate.yml).
|
# github PRs only (see lint-extra in .github/workflows/validate.yml).
|
||||||
#
|
#
|
||||||
# For the default linter config, see .golangci.yml. This config should
|
# For the default linter config, see .golangci.yml. This config should
|
||||||
# only enable additional linters not enabled in the default config.
|
# only enable additional linters not enabled in the default config.
|
||||||
|
Reference in New Issue
Block a user