From 9b77d249891f571e22ea92d1670e7fadce0d9214 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 11:41:15 -0800 Subject: [PATCH 1/7] ci: add golangci-lint job Taken from runc. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 38 ++++++++++++++++++++++++++++++++++ .golangci-extra.yml | 12 +++++++++++ .golangci.yml | 13 ++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .github/workflows/validate.yml create mode 100644 .golangci-extra.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..88a875a --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,38 @@ +name: validate +on: + push: + tags: + - v* + branches: + - main + - release-* + pull_request: +env: + GO_VERSION: 1.24 +permissions: + contents: read + +jobs: + lint: + timeout-minutes: 30 + permissions: + contents: read + pull-requests: read + checks: write # to allow the action to annotate code in the PR. + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + - uses: golangci/golangci-lint-action@v6 + with: + version: v1.64 + # Extra linters, only checking new code from a pull request. + - name: lint-extra + if: github.event_name == 'pull_request' + run: | + golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 + diff --git a/.golangci-extra.yml b/.golangci-extra.yml new file mode 100644 index 0000000..1a12d7b --- /dev/null +++ b/.golangci-extra.yml @@ -0,0 +1,12 @@ +# This is golangci-lint config file which is used to check NEW code in +# github PRs only (see lint-extra in .github/workflows/validate.yml). +# +# For the default linter config, see .golangci.yml. This config should +# only enable additional linters not enabled in the default config. + +linters: + disable-all: true + enable: + - godot + - revive + diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..66aa75a --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,13 @@ +# For documentation, see https://golangci-lint.run/usage/configuration/ + +linters: + enable: + - gofumpt + - errorlint + - unconvert + - unparam + +linters-settings: + govet: + enable: + - nilness From ce0ab9e168b15776468a366f9b6149ce74420584 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 11:51:50 -0800 Subject: [PATCH 2/7] ci: add go-fix job Taken from runc. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 88a875a..6472080 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -36,3 +36,16 @@ jobs: run: | golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 + go-fix: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + - name: run go fix + run: | + go fix ./... + git diff --exit-code From 2b5ec594faf1fb5f973892e4178c14daa6bc7013 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 11:52:50 -0800 Subject: [PATCH 3/7] ci: add codespell job Also, fix a typo found in RELEASES.md. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 10 ++++++++++ RELEASES.md | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6472080..f2cff1b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -49,3 +49,13 @@ jobs: run: | go fix ./... git diff --exit-code + + codespell: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: install deps + # Use a known version of codespell. + run: pip install --break-system-packages codespell==v2.4.1 + - name: run codespell + run: codespell diff --git a/RELEASES.md b/RELEASES.md index 028ec26..e380270 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -23,7 +23,7 @@ However, specification releases have special restrictions in the [OCI charter][c * They are the target of backwards compatibility (§7.g), and * They are subject to the OFWa patent grant (§8.d and e). -To avoid unfortunate side effects (onerous backwards compatibity requirements or Member resignations), the following additional procedures apply to specification releases: +To avoid unfortunate side effects (onerous backwards compatibility requirements or Member resignations), the following additional procedures apply to specification releases: ### Planning a release From 0bbb4a3a7cda1213d77ad834b1d42d009640eef4 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 11:55:17 -0800 Subject: [PATCH 4/7] ci: add a space-at-eol job Taken from runc. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f2cff1b..ab1a55f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -59,3 +59,9 @@ jobs: run: pip install --break-system-packages codespell==v2.4.1 - name: run codespell run: codespell + + space-at-eol: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi From b83d78a2721c6027f140e9e69981dc8839ee3ca3 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 12:06:16 -0800 Subject: [PATCH 5/7] ci: add deps job Simpler than that in runc as we don't use vendor here. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ab1a55f..bfdf3f0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -65,3 +65,12 @@ jobs: steps: - uses: actions/checkout@v4 - run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi + + deps: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + - run: go mod tidy --diff From 92d17cfc57361255647e9b40b74ac1900ca1b31c Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 12:11:57 -0800 Subject: [PATCH 6/7] ci: add all-done job This is so we can mark it as required in PR merge rules. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bfdf3f0..8c28fb9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -74,3 +74,14 @@ jobs: with: go-version: "${{ env.GO_VERSION }}" - run: go mod tidy --diff + + all-done: + needs: + - codespell + - deps + - go-fix + - lint + - space-at-eol + runs-on: ubuntu-24.04 + steps: + - run: echo "All jobs completed" From e614e265a8526ada8dc85d8b3dbc95831a5b371b Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sun, 2 Mar 2025 12:20:40 -0800 Subject: [PATCH 7/7] ci: add test/unit and test/all-done Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f0897a5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: test +on: + push: + tags: + - v* + branches: + - main + - release-* + pull_request: +permissions: + contents: read + +jobs: + unit: + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04] + go-version: [1.23.x, 1.24.x] + race: ["-race", ""] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - run: go test -timeout 3m ${{ matrix.race }} -v ./... + + all-done: + needs: + - unit + runs-on: ubuntu-24.04 + steps: + - run: echo "All jobs completed"