Skip to content

Tests

Tests #414

Workflow file for this run

name: Tests
on:
pull_request: ~
push:
branches: [ main ]
# Allow job to be triggered manually.
workflow_dispatch:
# Run job each night after CrateDB nightly has been published.
schedule:
- cron: '0 3 * * *'
# Cancel in-progress jobs when pushing to the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "Go ${{ matrix.go-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go-version: [ 1.20.x, 1.21.x ]
steps:
- name: Acquire sources
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Apply module cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Lint code using gofmt
run: |
./devtools/check-gofmt
- name: Unit tests
run: |
go test -v
- name: Integration tests
if: runner.os == 'Linux'
run: |
docker compose --file tests/docker-compose.yaml up --detach
pip install -r requirements-test.txt
pytest