Skip to content

Commit 06b737b

Browse files
author
Mrunal Patel
authored
Merge pull request #2687 from kolyshkin/more-github-actions
More GitHub actions
2 parents d15ffff + c6ed185 commit 06b737b

File tree

4 files changed

+93
-29
lines changed

4 files changed

+93
-29
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/validate.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: validate
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
pull_request:
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: golangci-lint
16+
uses: golangci/golangci-lint-action@v2
17+
with:
18+
# must be specified without patch version
19+
version: v1.31
20+
21+
# Only show new issues for a pull request.
22+
only-new-issues: true
23+
24+
shfmt:
25+
name: shfmt
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: vars
30+
run: |
31+
echo "VERSION=3.2.0" >> $GITHUB_ENV
32+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
33+
- name: cache go mod and $GOCACHE
34+
uses: actions/cache@v2
35+
with:
36+
path: |
37+
~/go/pkg/mod
38+
~/.cache/go-build
39+
key: ${{ runner.os }}-shfmt-${{ env.VERSION }}
40+
restore-keys: ${{ runner.os }}-shfmt-
41+
- name: install shfmt
42+
run: |
43+
command -v shfmt || \
44+
(cd ~ && GO111MODULE=on time go get mvdan.cc/sh/v3/cmd/shfmt@v$VERSION)
45+
- name: shfmt
46+
run: make shfmt
47+
48+
shellcheck:
49+
name: shellcheck
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v2
53+
- name: vars
54+
run: |
55+
echo 'VERSION=v0.7.1' >> $GITHUB_ENV
56+
echo 'BASEURL=https://github.com/koalaman/shellcheck/releases/download' >> $GITHUB_ENV
57+
echo 'SHA256SUM=1e8499d6f90481bfa2af7a4dce86dd9bcba5c0fbd88bf4793b34ec679c8bb98a' >> $GITHUB_ENV
58+
echo ~/bin >> $GITHUB_PATH
59+
- name: install shellcheck
60+
run: |
61+
mkdir ~/bin
62+
curl -sSfL $BASEURL/$VERSION/shellcheck-$VERSION.linux.x86_64.tar.xz |
63+
tar xfJ - -C ~/bin --strip 1 shellcheck-$VERSION/shellcheck
64+
sha256sum ~/bin/shellcheck | grep -q $SHA256SUM
65+
# make sure to remove the old version
66+
sudo rm -f /usr/bin/shellcheck
67+
- uses: lumaxis/shellcheck-problem-matchers@v1
68+
- name: shellcheck
69+
run: |
70+
make shellcheck
71+
72+
deps:
73+
name: deps
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v2
77+
- name: cache go mod and $GOCACHE
78+
uses: actions/cache@v2
79+
with:
80+
path: |
81+
~/go/pkg/mod
82+
~/.cache/go-build
83+
key: ${{ runner.os }}-go.sum-${{ hashFiles('**/go.sum') }}
84+
restore-keys: ${{ runner.os }}-go.sum-
85+
- name: verify deps
86+
run: make verify-dependencies

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ cache:
1010
- /home/travis/.vagrant.d/boxes
1111
jobs:
1212
include:
13-
- go: 1.15.x
14-
name: "verify-dependencies"
15-
script:
16-
- make verify-dependencies
1713
- go: 1.15.x
1814
name: "cgroup-systemd"
1915
env:

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ validate:
121121
script/validate-gofmt
122122
script/validate-c
123123
$(GO) vet $(MOD_VENDOR) ./...
124+
125+
shellcheck:
124126
shellcheck tests/integration/*.bats
125127
# TODO: add shellcheck for sh files
126-
shfmt -ln bats -d tests/integration/*.bats
127-
shfmt -ln bash -d man/*.sh script/*.sh tests/*.sh tests/integration/*.bash
128+
129+
shfmt:
130+
shfmt -ln bats -d -w tests/integration/*.bats
131+
shfmt -ln bash -d -w man/*.sh script/*.sh tests/*.sh tests/integration/*.bash
128132

129133
ci: validate test release
130134

@@ -153,5 +157,5 @@ localcross:
153157
.PHONY: runc all recvtty static release dbuild lint man runcimage \
154158
test localtest unittest localunittest integration localintegration \
155159
rootlessintegration localrootlessintegration shell install install-bash \
156-
install-man clean validate ci \
160+
install-man clean validate ci shfmt shellcheck \
157161
vendor verify-dependencies cross localcross

0 commit comments

Comments
 (0)