mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 22:37:14 +08:00
c6ed18542d
Note that 1. No golang caching is required, since we do not build any go code, and it does not look like it make sense to cache a single binary we donwload from github. 2. Use a problem matcher, so the PRs will be annotated with shellcheck warnings. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
name: validate
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
jobs:
|
|
golangci:
|
|
name: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v2
|
|
with:
|
|
# must be specified without patch version
|
|
version: v1.31
|
|
|
|
# Only show new issues for a pull request.
|
|
only-new-issues: true
|
|
|
|
shfmt:
|
|
name: shfmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: vars
|
|
run: |
|
|
echo "VERSION=3.2.0" >> $GITHUB_ENV
|
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
- name: cache go mod and $GOCACHE
|
|
uses: actions/cache@v2
|
|
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
|
|
run: make shfmt
|
|
|
|
shellcheck:
|
|
name: shellcheck
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: vars
|
|
run: |
|
|
echo 'VERSION=v0.7.1' >> $GITHUB_ENV
|
|
echo 'BASEURL=https://github.com/koalaman/shellcheck/releases/download' >> $GITHUB_ENV
|
|
echo 'SHA256SUM=1e8499d6f90481bfa2af7a4dce86dd9bcba5c0fbd88bf4793b34ec679c8bb98a' >> $GITHUB_ENV
|
|
echo ~/bin >> $GITHUB_PATH
|
|
- name: install shellcheck
|
|
run: |
|
|
mkdir ~/bin
|
|
curl -sSfL $BASEURL/$VERSION/shellcheck-$VERSION.linux.x86_64.tar.xz |
|
|
tar xfJ - -C ~/bin --strip 1 shellcheck-$VERSION/shellcheck
|
|
sha256sum ~/bin/shellcheck | grep -q $SHA256SUM
|
|
# make sure to remove the old version
|
|
sudo rm -f /usr/bin/shellcheck
|
|
- uses: lumaxis/shellcheck-problem-matchers@v1
|
|
- name: shellcheck
|
|
run: |
|
|
make shellcheck
|
|
|
|
deps:
|
|
name: deps
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: cache go mod and $GOCACHE
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
key: ${{ runner.os }}-go.sum-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-go.sum-
|
|
- name: verify deps
|
|
run: make verify-dependencies
|