mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 03:46:19 +08:00
ci: bump shfmt to 3.5.1, simplify CI setup
1. Bump shfmt to v3.5.1. Release notes: https://github.com/mvdan/sh/releases 2. Since shfmt v3.5.0, specifying -l bash (or -l bats) is no longer necessary. Therefore, we can use shfmt to find all the files. Add .editorconfig to ignore vendor subdirectory. 3. Use shfmt docker image, so that we don't have to install anything explicitly. This greatly simplifies the shfmt CI job. Add localshfmt target so developers can still use a local shfmt binary when necessary. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# This file is used by shfmt. See https://EditorConfig.org
|
||||||
|
|
||||||
|
# This is a top-most EditorConfig file.
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Ignore the entire "vendor" directory.
|
||||||
|
[vendor/**]
|
||||||
|
ignore = true
|
16
.github/workflows/validate.yml
vendored
16
.github/workflows/validate.yml
vendored
@@ -67,22 +67,6 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: vars
|
|
||||||
run: |
|
|
||||||
echo "VERSION=3.3.1" >> $GITHUB_ENV
|
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
||||||
- name: cache go mod and $GOCACHE
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/go/pkg/mod
|
|
||||||
~/.cache/go-build
|
|
||||||
key: ${{ runner.os }}-shfmt-${{ env.VERSION }}
|
|
||||||
restore-keys: ${{ runner.os }}-shfmt-
|
|
||||||
- name: install shfmt
|
|
||||||
run: |
|
|
||||||
command -v shfmt || \
|
|
||||||
(cd ~ && GO111MODULE=on time go get mvdan.cc/sh/v3/cmd/shfmt@v$VERSION)
|
|
||||||
- name: shfmt
|
- name: shfmt
|
||||||
run: make shfmt
|
run: make shfmt
|
||||||
|
|
||||||
|
12
Makefile
12
Makefile
@@ -165,10 +165,12 @@ shellcheck:
|
|||||||
# TODO: add shellcheck for more sh files (contrib/completions/bash/runc).
|
# TODO: add shellcheck for more sh files (contrib/completions/bash/runc).
|
||||||
|
|
||||||
shfmt:
|
shfmt:
|
||||||
shfmt -ln bats -d -w tests/integration/*.bats
|
$(CONTAINER_ENGINE) run $(CONTAINER_ENGINE_RUN_FLAGS) \
|
||||||
shfmt -ln bash -d -w man/*.sh script/* \
|
--rm -v $(CURDIR):/src -w /src \
|
||||||
tests/*.sh tests/integration/*.bash tests/fuzzing/*.sh \
|
mvdan/shfmt:v3.5.1 -d -w .
|
||||||
contrib/completions/bash/runc contrib/cmd/seccompagent/*.sh
|
|
||||||
|
localshfmt:
|
||||||
|
shfmt -d -w .
|
||||||
|
|
||||||
vendor:
|
vendor:
|
||||||
$(GO) mod tidy
|
$(GO) mod tidy
|
||||||
@@ -192,5 +194,5 @@ verify-dependencies: vendor
|
|||||||
localrelease dbuild lint man runcimage \
|
localrelease dbuild lint man runcimage \
|
||||||
test localtest unittest localunittest integration localintegration \
|
test localtest unittest localunittest integration localintegration \
|
||||||
rootlessintegration localrootlessintegration shell install install-bash \
|
rootlessintegration localrootlessintegration shell install install-bash \
|
||||||
install-man clean cfmt shfmt shellcheck \
|
install-man clean cfmt shfmt localshfmt shellcheck \
|
||||||
vendor verify-changelog verify-dependencies
|
vendor verify-changelog verify-dependencies
|
||||||
|
Reference in New Issue
Block a user