Skip to content

Merge pull request #1124 from go-kivik/opts05 #95

Merge pull request #1124 from go-kivik/opts05

Merge pull request #1124 from go-kivik/opts05 #95

Workflow file for this run

name: Tests
on:
push:
branches: [main]
pull_request:
jobs:
go:
name: Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
env:
USETC: "1"
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -race -shuffle=on ./...
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: go mod download
- name: Generate and upload code coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
echo "" > coverage.txt
TEST_PKGS=$(go list ./... | grep -v /test/)
for d in $TEST_PKGS; do
go test -coverprofile=profile.out -covermode=set "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
curl -fs https://codecov.io/bash | bash -s -- -Z
gopherjs:
name: GopherJS ${{ matrix.go }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- go: "1.19"
node: "18"
gopherjs: v1.19.0-beta2
container:
image: golang:${{ matrix.go }}
env:
USETC: "1"
NPM_PROFILE: pouchdb/pouchdb9-package.json
GOFLAGS: '-buildvcs=false'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node }}.x
run: |
curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | sed -e '/sleep/d' | bash -
apt-get update -qq && apt-get install -y nodejs
- name: Install npm dependencies
run: |
cp "$NPM_PROFILE" package.json
npm install -g [email protected] && npm update
npm install
npm install source-map-support
- name: Install GopherJS
run: |
mkdir -p /tmp/src
( cd /tmp && go install github.com/gopherjs/gopherjs@${{ matrix.gopherjs }} )
npm install --force https://github.com/gopherjs/gopherjs/archive/refs/tags/${{ matrix.gopherjs }}.tar.gz
npm list
- name: Run GopherJS tests
run: |
gopherjs test $(go list ./... | grep -Ev '/cmd/|/kiviktest/testcontainers')
test-x-sqlite:
name: "x/sqlite: Go ${{ matrix.go-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.22", "1.23", "1.24", "1.25"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
working-directory: x/sqlite
run: |
go mod download
go test -race -shuffle=on ./...
test-x-pg:
name: "x/pg: Go ${{ matrix.go-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.24", "1.25"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
working-directory: x/pg
run: |
go mod download
go test -race -shuffle=on ./...