Skip to content

chore: add ci workflow to test and lint #11

chore: add ci workflow to test and lint

chore: add ci workflow to test and lint #11

Workflow file for this run

name: Lint & Test
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- 'website/**'
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'website/**'
jobs:
lint-module:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
test-module:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.18', '1.19', '1.20', '1.21']
mongodb-version: ['4.4', '5.0', '6.0', '7.0'] # add 3.6 as well after fixing the tests (collection creation)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Start MongoDB Replica Set
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: replset
mongodb-db: mgoddb
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Run tests
run: go test ./...