mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
# This workflow runs all dockerfiles in this repo
|
|
name: checks
|
|
|
|
on:
|
|
# Triggers the workflow on push or pull request events but only for the main branch
|
|
push:
|
|
branches: [ v2 ]
|
|
pull_request:
|
|
branches: [ v2 ]
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
GO_VERSION: 1.19
|
|
GOLANGCI_LINT_VERSION: v1.48
|
|
|
|
jobs:
|
|
matrix:
|
|
name: matrix
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
gomod: ${{ steps.gomod.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- id: gomod
|
|
run: |
|
|
matrix=$(find . -type f -name "go.mod" -print0 | xargs -0 -n1 dirname | sort --unique | jq -R -s -c 'split("\n")[:-1]')
|
|
echo "${matrix}"
|
|
echo "::set-output name=matrix::${matrix}"
|
|
lint:
|
|
name: lint
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
gomod: ${{ fromJson(needs.matrix.outputs.gomod) }}
|
|
env:
|
|
GOFLAGS: -mod=readonly
|
|
GOPROXY: https://proxy.golang.org
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- uses: golangci/golangci-lint-action@v3.2.0
|
|
with:
|
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
|
working-directory: ${{ matrix.gomod }}
|
|
test:
|
|
name: test
|
|
needs: matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
gomod: ${{ fromJson(needs.matrix.outputs.gomod) }}
|
|
env:
|
|
GOFLAGS: -mod=readonly
|
|
GOPROXY: https://proxy.golang.org
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- run: go test -v ./...
|
|
|