diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b2d269..7c31b94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,52 +7,18 @@ on: branches: [ main ] jobs: - build: - name: Project CI + name: CI runs-on: ubuntu-22.04 timeout-minutes: 5 steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 - with: - go-version: 1.19 - id: go - - - name: Setup Go binary path - shell: bash - run: | - echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV - echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: src/github.com/containerd/project fetch-depth: 25 - - name: Install dependencies - env: - GO111MODULE: on - run: | - go install github.com/vbatts/git-validation@latest - go install github.com/kunalkushwaha/ltag@latest - - - name: Check DCO/whitespace/commit message - env: - GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }} - DCO_VERBOSITY: "-q" - DCO_RANGE: "" - working-directory: src/github.com/containerd/project - run: | - if [ -z "${GITHUB_COMMIT_URL}" ]; then - DCO_RANGE=$(jq -r '.before +".."+ .after' ${GITHUB_EVENT_PATH}) - else - DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha +".."+ .[-1].sha') - fi - script/validate/dco - - - name: Check file headers - run: script/validate/fileheader - working-directory: src/github.com/containerd/project + - uses: containerd/project-checks@v1.2.2 + with: + working-directory: src/github.com/containerd/project diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5c19764 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/containerd/project + +go 1.23.1 + +// required for project-checks action diff --git a/script/validate/dco b/script/validate/dco deleted file mode 100755 index aa35ae2..0000000 --- a/script/validate/dco +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -set -eu -o pipefail - -if ! command -v git-validation; then - >&2 echo "ERROR: git-validation not found. Install with:" - >&2 echo " go get -u github.com/vbatts/git-validation" - exit 1 -fi - -verbosity="${DCO_VERBOSITY--v}" -range= -commit_range="${DCO_RANGE-}" -[ ! -z "${commit_range}" ] && { - range="-range ${commit_range}" -} -GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation ${verbosity} ${range} -run DCO,short-subject,dangling-whitespace diff --git a/script/validate/fileheader b/script/validate/fileheader deleted file mode 100755 index b866b42..0000000 --- a/script/validate/fileheader +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -set -eu -o pipefail - -if ! command -v ltag; then - >&2 echo "ERROR: ltag not found. Install with:" - >&2 echo " go get -u github.com/kunalkushwaha/ltag" - exit 1 -fi - -BASEPATH="${1-}" - -ltag -t "${BASEPATH}script/validate/template" --excludes "vendor contrib" --check -v diff --git a/script/validate/template/bash.txt b/script/validate/template/bash.txt deleted file mode 100644 index b8424f3..0000000 --- a/script/validate/template/bash.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/script/validate/template/dockerfile.txt b/script/validate/template/dockerfile.txt deleted file mode 100644 index b8424f3..0000000 --- a/script/validate/template/dockerfile.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/script/validate/template/go.txt b/script/validate/template/go.txt deleted file mode 100644 index bee278d..0000000 --- a/script/validate/template/go.txt +++ /dev/null @@ -1,16 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - diff --git a/script/validate/template/makefile.txt b/script/validate/template/makefile.txt deleted file mode 100644 index b8424f3..0000000 --- a/script/validate/template/makefile.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/script/validate/vendor b/script/validate/vendor deleted file mode 100755 index 021f107..0000000 --- a/script/validate/vendor +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -set -eu -o pipefail - -if [ -f vendor.conf ]; then - rm -rf vendor/ - vndr |& grep -v -i clone -else - go mod tidy - if [ -d vendor ]; then - rm -rf vendor/ - go mod vendor - fi -fi - -DIFF_PATH="vendor/ go.mod go.sum" - -# need word splitting here to avoid reading the whole DIFF_PATH as one pathspec -# -# shellcheck disable=SC2046 -DIFF=$(git status --porcelain -- $DIFF_PATH) - -if [ "$DIFF" ]; then - echo - echo "These files were modified:" - echo - echo "$DIFF" - echo - exit 1 -else - echo "$DIFF_PATH is correct" -fi