Skip to content

Update build & test workflows #452

Update build & test workflows

Update build & test workflows #452

Workflow file for this run

name: Embedded Postgres
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
id: go
uses: actions/checkout@v4
- name: Set Up Golang
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Check Dependencies
run: |
go list -json -deps > go.list
for d in "." "examples" "platform-test"; do
pushd $d
go mod tidy
if [ ! -z "$(git status --porcelain go.mod)" ]; then
printf "go.mod has modifications\n"
git diff go.mod
exit 1
fi
if [ ! -z "$(git status --porcelain go.sum)" ]; then
printf "go.sum has modifications\n"
git diff go.sum
exit 1
fi
popd
done;
- name: Nancy Vulnerability
uses: sonatype-nexus-community/nancy-github-action@main
with:
nancyVersion: v1.0.46
nancyCommand: sleuth
- name: GolangCI Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1
/home/runner/go/bin/golangci-lint run
- name: Test
run: go test -v -test.timeout 0 -race -cover -covermode=atomic -coverprofile=coverage.out ./...
- name: Test Examples
run: |
pushd examples && \
go test -v ./... && \
popd
- name: Upload Coverage Report
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: go install github.com/mattn/goveralls@latest && $(go env GOPATH)/bin/goveralls -v -coverprofile=coverage.out -service=github
alpine_tests:
name: Alpine Linux Platform Tests
runs-on: ubuntu-latest
container:
image: golang:1.22-alpine
steps:
- uses: actions/checkout@v4
- name: Set Up
run: |
apk add --upgrade gcc g++ && \
adduser testuser -D
- name: All Tests
run: su - testuser -c 'export PATH=$PATH:/usr/local/go/bin; cd /__w/embedded-postgres/embedded-postgres && go test -v ./... && cd platform-test && go test -v ./...'
platform_tests:
name: Platform tests
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-11 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Golang
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Platform Tests
run: |
cd platform-test
go test -v -race ./...