Merge pull request #157 from digitalocean/dependabot/go_modules/githu… #199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.21.x, 1.22.x] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Restore cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Ensure code is formatted with gofmt | |
run: make check-fmt | |
if: matrix.os == 'ubuntu-latest' | |
- name: Ensure generated code was recreated if needed | |
run: make check-generate | |
if: matrix.os == 'ubuntu-latest' | |
- name: Lint with golangci-lint | |
if: matrix.os == 'ubuntu-latest' | |
run: make lint | |
- name: Run unit tests | |
run: make test | |
- name: Verify plugin binary works with Packer | |
run: make plugin-check | |
if: matrix.os == 'ubuntu-latest' |