Skip to content

Commit

Permalink
Merge pull request #4077 from werf/commit-tests-workflow
Browse files Browse the repository at this point in the history
ci: added commit-tests workflow to run unit tests and lint
  • Loading branch information
distorhead committed Jan 19, 2022
2 parents b74eb64 + 68d2925 commit 4ec0151
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 31 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/commit_tests.yml
@@ -0,0 +1,56 @@
name: Commit tests

on:
push:
paths:
- '.github/workflows/commit_tests.yml'
- '**/*.go'

jobs:
unit-test:
name: Unit testing
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=readonly
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Checkout code
uses: actions/checkout@v2

- name: Prepare environment
run: |
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libbtrfs-dev
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Test
run: |
make unit-test
lint:
name: Lint
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=readonly
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Checkout code
uses: actions/checkout@v2

- name: Prepare environment
run: |
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libbtrfs-dev
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.43.0
- name: Lint
run: |
make lint
30 changes: 0 additions & 30 deletions .github/workflows/lint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -17,7 +17,7 @@ fmt:
gofumpt -w cmd/ pkg/

lint:
golangci-lint -E bidichk -E errname run ./... --build-tags="dfrunmount dfssh containers_image_openpgp osusergo exclude_graphdriver_devicemapper netgo no_devmapper static_build"
golangci-lint run ./... --build-tags="dfrunmount dfssh containers_image_openpgp osusergo exclude_graphdriver_devicemapper netgo no_devmapper static_build"


clean:
Expand Down

0 comments on commit 4ec0151

Please sign in to comment.