diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 0000000..8c046ef --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,26 @@ +name: go-test + +on: + push: + tags: + - v* + branches: + - main + pull_request: + +jobs: + go-test: + name: go-test + strategy: + matrix: + go-version: [1.20.x, 1.21.x] + # XXX: is it actually useful to run unit tests on macOS? + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + - name: go-test + run: go test ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5e412ff..b24831b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,7 +1,7 @@ # This file was copied from the following URL and modified: # https://github.com/golangci/golangci-lint-action/blob/master/README.md#how-to-use -name: golangci +name: golangci-lint on: push: tags: @@ -9,27 +9,25 @@ on: branches: - main pull_request: + permissions: contents: read pull-requests: read + jobs: golangci: name: lint - strategy: - matrix: - go-version: [1.20.x, 1.21.x] - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: ${{ matrix.go-version }} + go-version: 1.21.x + cache: false - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.53.3 # current version at time of commit - args: --timeout 10m - only-new-issues: true - - name: go-test - run: go test ./... + version: v1.54 # current version at time of commit + args: --timeout=10m + # Only show new issues in a PR but show all issues for pushes + only-new-issues: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}