Просмотр исходного кода

Merge pull request #536 from smallstep/max/dev

Move golangci-lint to github action and fix debian build action
Max 5 лет назад
Родитель
Сommit
938cd092b4
4 измененных файлов с 78 добавлено и 17 удалено
  1. 32 5
      .github/workflows/release.yml
  2. 41 9
      .github/workflows/test.yml
  3. 2 2
      Makefile
  4. 3 1
      debian/rules

+ 32 - 5
.github/workflows/release.yml

@@ -10,6 +10,9 @@ jobs:
   test:
     name: Lint, Test, Build
     runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        go: [ '1.15', '1.16' ]
     outputs:
       is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
     steps:
@@ -20,15 +23,39 @@ jobs:
         name: Setup Go
         uses: actions/setup-go@v2
         with:
-          go-version: '1.15.8'
+          go-version: ${{ matrix.go }}
       -
         name: Install Deps
         id: install-deps
         run: sudo apt-get -y install libpcsclite-dev
       -
-        name: Lint, Test, Build
+        name: golangci-lint
+        uses: golangci/golangci-lint-action@v2
+        with:
+          # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
+          version: 'latest'
+
+          # Optional: working directory, useful for monorepos
+          # working-directory: somedir
+
+          # Optional: golangci-lint command line arguments.
+          args: --timeout=30m
+
+          # Optional: show only new issues if it's a pull request. The default value is `false`.
+          # only-new-issues: true
+
+          # Optional: if set to true then the action will use pre-installed Go.
+          # skip-go-installation: true
+
+          # Optional: if set to true then the action don't cache or restore ~/go/pkg.
+          # skip-pkg-cache: true
+
+          # Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
+          # skip-build-cache: true
+      -
+        name: Test, Build
         id: lint_test_build
-        run: V=1 make -j1 bootstrap ci
+        run: V=1 make ci
 
   create_release:
     name: Create Release
@@ -96,7 +123,7 @@ jobs:
         name: Set up Go
         uses: actions/setup-go@v2
         with:
-          go-version: '1.15.8'
+          go-version: '1.16'
       -
         name: APT Install
         id: aptInstall
@@ -126,7 +153,7 @@ jobs:
       - name: Setup Go
         uses: actions/setup-go@v2
         with:
-          go-version: '1.15.8'
+          go-version: '1.16'
       - name: Build
         id: build
         run: |

+ 41 - 9
.github/workflows/test.yml

@@ -11,21 +11,53 @@ on:
 jobs:
   lintTestBuild:
     name: Lint, Test, Build
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        go: [ '1.15', '1.16' ]
     steps:
-      - name: Checkout
+      -
+        name: Checkout
         uses: actions/checkout@v2
-      - name: Setup Go
+      -
+        name: Setup Go
         uses: actions/setup-go@v2
         with:
-          go-version: '1.15.6'
-      - name: Install Deps
+          go-version: ${{ matrix.go }}
+      -
+        name: Install Deps
         id: install-deps
         run: sudo apt-get -y install libpcsclite-dev
-      - name: Lint, Test, Build
-        id: lintTestBuild
-        run: V=1 make -j1 bootstrap ci
-      - name: Codecov
+      -
+        name: golangci-lint
+        uses: golangci/golangci-lint-action@v2
+        with:
+          # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
+          version: 'latest'
+
+          # Optional: working directory, useful for monorepos
+          # working-directory: somedir
+
+          # Optional: golangci-lint command line arguments.
+          args: --timeout=30m
+
+          # Optional: show only new issues if it's a pull request. The default value is `false`.
+          # only-new-issues: true
+
+          # Optional: if set to true then the action will use pre-installed Go.
+          # skip-go-installation: true
+
+          # Optional: if set to true then the action don't cache or restore ~/go/pkg.
+          # skip-pkg-cache: true
+
+          # Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
+          # skip-build-cache: true
+      -
+        name: Test, Build
+        id: lint_test_build
+        run: V=1 make ci
+      -
+        name: Codecov
         uses: codecov/codecov-action@v1.2.1
         with:
           token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

+ 2 - 2
Makefile

@@ -18,7 +18,7 @@ OUTPUT_ROOT=output/
 
 all: lint test build
 
-ci: lintcgo testcgo build
+ci: testcgo build
 
 .PHONY: all ci
 
@@ -28,7 +28,7 @@ ci: lintcgo testcgo build
 
 bootstra%:
 	# Using a released version of golangci-lint to take into account custom replacements in their go.mod
-	$Q GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0
+	$Q curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0
 
 .PHONY: bootstra%
 

+ 3 - 1
debian/rules

@@ -4,8 +4,10 @@ override_dh_install-arch:
 	dh_install --arch
 
 build:
-	make bootstrap
 	dh build
 
+override_dh_auto_build:
+	dh_auto_build -- build
+
 %:
 	dh $@