Merge pull request #303 from liulanzheng/main #143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
# | |
# Linter checker | |
# | |
linters: | |
name: Linters | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
go-version: [1.22.0] | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v4 | |
- uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59 | |
skip-cache: true | |
args: --timeout=5m | |
# | |
# Project checker | |
# | |
# based on https://github.com/containerd/project-checks/blob/main/action.yml | |
project: | |
name: Project Checks | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/accelerated-container-image | |
fetch-depth: 100 | |
- name: set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
# TODO(fuweid): remove the env GO111MODULE=off in new version of go | |
- name: install dependencies | |
shell: bash | |
env: | |
GO111MODULE: off | |
run: | | |
echo "::group:: install dependencies" | |
go get -u -v github.com/vbatts/git-validation | |
go get -u -v github.com/kunalkushwaha/ltag | |
echo "::endgroup::" | |
- name: DCO checker | |
shell: bash | |
working-directory: src/github.com/containerd/accelerated-container-image | |
env: | |
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }} | |
DCO_VERBOSITY: "-v" | |
DCO_RANGE: "" | |
run: | | |
echo "::group:: DCO checks" | |
set -eu -o pipefail | |
if [ -z "${GITHUB_COMMIT_URL}" ]; then | |
DCO_RANGE=$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH}) | |
else | |
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha + "..HEAD"') | |
fi | |
range= | |
[ ! -z "${DCO_RANGE}" ] && range="-range ${DCO_RANGE}" | |
git-validation ${DCO_VERBOSITY} ${range} -run DCO,short-subject,dangling-whitespace | |
echo "::endgroup::" | |
- name: validate file headers | |
shell: bash | |
working-directory: src/github.com/containerd/accelerated-container-image | |
run: | | |
set -eu -o pipefail | |
echo "::group:: file headers" | |
ltag -t "script/validate/template" --excludes "vendor contrib" --check -v | |
echo "::endgroup::" |