Update GitHub actions CI workflow

Update GitHub Actions runner OS from Ubuntu 18.04 to Ubuntu 22.04.
Update actions/setup-go from v2 to v3. Update Go compiler from Go 1.17
to Go 1.20. Update golangci-lint from v1.45.0 to v1.51.2 for Go 1.20
support. Remove deprecated `-i` flag from make coverage target.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
This commit is contained in:
Austin Vazquez 2022-10-25 03:22:29 +00:00
parent 36fd7c3f33
commit c7b5a322ed
3 changed files with 27 additions and 16 deletions

View File

@ -6,6 +6,9 @@ on:
pull_request: pull_request:
branches: [ main ] branches: [ main ]
env:
GO_VERSION: 1.20.x
permissions: permissions:
contents: read contents: read
pull-requests: read pull-requests: read
@ -21,19 +24,28 @@ jobs:
strategy: strategy:
matrix: matrix:
go-version: [1.17]
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
path: src/github.com/containerd/ttrpc
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.45.0 version: v1.51.2
args: --timeout=5m args: --timeout=5m
skip-cache: true skip-cache: true
working-directory: src/github.com/containerd/ttrpc
- name: golangci-lint errors - name: golangci-lint errors
run: golangci-lint run run: golangci-lint run
working-directory: src/github.com/containerd/ttrpc
if: ${{ failure() }} if: ${{ failure() }}
# #
@ -41,20 +53,20 @@ jobs:
# #
project: project:
name: Project Checks name: Project Checks
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v3
with: with:
go-version: '1.17' go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
path: src/github.com/containerd/ttrpc path: src/github.com/containerd/ttrpc
fetch-depth: 25 fetch-depth: 25
- uses: containerd/project-checks@v1 - uses: containerd/project-checks@v1.1.0
with: with:
working-directory: src/github.com/containerd/ttrpc working-directory: src/github.com/containerd/ttrpc
@ -66,14 +78,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
name: ${{ matrix.os }} go: [1.19.x, 1.20.x]
name: ${{ matrix.os }} / ${{ matrix.go }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v3
with: with:
go-version: '1.17' go-version: ${{ matrix.go }}
- name: Check out code - name: Check out code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -101,14 +115,13 @@ jobs:
# #
protobuild: protobuild:
name: Run Protobuild name: Run Protobuild
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- name: Set up Go 1.17 - uses: actions/setup-go@v3
uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: ${{ env.GO_VERSION }}
id: go id: go
- name: Setup Go binary path - name: Setup Go binary path

View File

@ -1,7 +1,5 @@
linters: linters:
enable: enable:
- structcheck
- varcheck
- staticcheck - staticcheck
- unconvert - unconvert
- gofmt - gofmt

View File

@ -151,7 +151,7 @@ install-protobuild:
coverage: ## generate coverprofiles from the unit tests, except tests that require root coverage: ## generate coverprofiles from the unit tests, except tests that require root
@echo "$(WHALE) $@" @echo "$(WHALE) $@"
@rm -f coverage.txt @rm -f coverage.txt
@$(GO) test -i ${TESTFLAGS} ${TESTPACKAGES} 2> /dev/null @$(GO) test ${TESTFLAGS} ${TESTPACKAGES} 2> /dev/null
@( for pkg in ${PACKAGES}; do \ @( for pkg in ${PACKAGES}; do \
$(GO) test ${TESTFLAGS} \ $(GO) test ${TESTFLAGS} \
-cover \ -cover \