Skip to content

Commit

Permalink
Merge pull request #2687 from kolyshkin/more-github-actions
Browse files Browse the repository at this point in the history
More GitHub actions
  • Loading branch information
Mrunal Patel authored Nov 24, 2020
2 parents d15ffff + c6ed185 commit 06b737b
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 29 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/golangci-lint.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ cache:
- /home/travis/.vagrant.d/boxes
jobs:
include:
- go: 1.15.x
name: "verify-dependencies"
script:
- make verify-dependencies
- go: 1.15.x
name: "cgroup-systemd"
env:
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ validate:
script/validate-gofmt
script/validate-c
$(GO) vet $(MOD_VENDOR) ./...

shellcheck:
shellcheck tests/integration/*.bats
# TODO: add shellcheck for sh files
shfmt -ln bats -d tests/integration/*.bats
shfmt -ln bash -d man/*.sh script/*.sh tests/*.sh tests/integration/*.bash

shfmt:
shfmt -ln bats -d -w tests/integration/*.bats
shfmt -ln bash -d -w man/*.sh script/*.sh tests/*.sh tests/integration/*.bash

ci: validate test release

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

0 comments on commit 06b737b

Please sign in to comment.