Update README.md #35
Workflow file for this run
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: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
go: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: ["1.17"] | |
path: ["", "examples"] | |
name: Go ${{ matrix.go }} ${{ matrix.path }} | |
steps: | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Go modules cache | |
id: cache-go-module | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-gomod-${{ matrix.path }}-${{ hashFiles('go.sum') }}- | |
restore-keys: | | |
${{ runner.os }}-gomod- | |
- name: Setup Go build cache | |
id: cache-go-build | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-gobuild-${{ matrix.path }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-gobuild- | |
- name: Download dependencies | |
working-directory: ${{ matrix.path }} | |
if: steps.cache-go-module.outputs.cache-hit != 'true' | |
run: go mod download | |
- name: Verify go modules up to date | |
working-directory: ${{ matrix.path }} | |
run: | | |
set -ex | |
go mod tidy | |
[ -z "$(git diff -- go.{mod,sum})" ] # Check there are no changes! | |
- name: Test | |
working-directory: ${{ matrix.path }} | |
run: go test ./... | |
- name: Lint | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
version: v1.41 | |
skip-go-installation: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
only-new-issues: false | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: --timeout=10m | |
working-directory: ${{ matrix.path }} | |
go-mongo: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:4.0 | |
ports: | |
- "27017" | |
strategy: | |
matrix: | |
go: ["1.17"] | |
path: ["storers/mongo"] | |
name: Go ${{ matrix.go }} ${{ matrix.path }} | |
steps: | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Go modules cache | |
id: cache-go-module | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-gomod-${{ matrix.path }}-${{ hashFiles('go.sum') }}- | |
restore-keys: | | |
${{ runner.os }}-gomod- | |
- name: Setup Go build cache | |
id: cache-go-build | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-gobuild-${{ matrix.path }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-gobuild- | |
- name: Download dependencies | |
working-directory: ${{ matrix.path }} | |
if: steps.cache-go-module.outputs.cache-hit != 'true' | |
run: go mod download | |
- name: Verify go modules up to date | |
working-directory: ${{ matrix.path }} | |
run: | | |
set -ex | |
go mod tidy | |
[ -z "$(git diff -- go.{mod,sum})" ] # Check there are no changes! | |
- name: Test | |
env: | |
GOTEST_MONGODB: mongodb://localhost:${{ job.services.mongo.ports[27017] }} | |
working-directory: ${{ matrix.path }} | |
run: go test ./... | |
- name: Lint | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
version: v1.41 | |
skip-go-installation: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
only-new-issues: false | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: --timeout=10m | |
working-directory: ${{ matrix.path }} |