...

Text file src/github.com/fergusstrange/embedded-postgres/.github/workflows/build.yml

Documentation: github.com/fergusstrange/embedded-postgres/.github/workflows

     1name: Embedded Postgres
     2on:
     3  push:
     4    branches: [ "master" ]
     5  pull_request:
     6    branches: [ "*" ]
     7jobs:
     8  tests:
     9    name: Tests
    10    runs-on: ubuntu-latest
    11    steps:
    12      - name: Checkout
    13        id: go
    14        uses: actions/checkout@v1
    15      - name: Set Up Golang
    16        uses: actions/setup-go@v3
    17        with:
    18          go-version: 1.18
    19      - name: Check Dependencies
    20        run: |
    21          go list -json -deps > go.list
    22          for d in "." "examples" "platform-test"; do
    23            pushd $d
    24            go mod tidy
    25            if [ ! -z "$(git status --porcelain go.mod)" ]; then
    26              printf "go.mod has modifications\n"
    27              git diff go.mod
    28              exit 1
    29            fi
    30            if [ ! -z "$(git status --porcelain go.sum)" ]; then
    31              printf "go.sum has modifications\n"
    32              git diff go.sum
    33              exit 1
    34            fi
    35            popd
    36          done;
    37      - name: Nancy Vulnerability
    38        uses: sonatype-nexus-community/nancy-github-action@main
    39        with:
    40          nancyVersion: v1.0.36
    41          nancyCommand: sleuth
    42      - name: GolangCI Lint
    43        run: |
    44          curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1
    45          /home/runner/go/bin/golangci-lint run
    46      - name: Test
    47        run: go test -v -test.timeout 0 -race -cover -covermode=atomic -coverprofile=coverage.out ./...
    48      - name: Test Examples
    49        run: |
    50          pushd examples && \
    51          go test -v ./... && \
    52          popd
    53      - name: Upload Coverage Report
    54        env:
    55          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    56        run: GO111MODULE=off go get github.com/mattn/goveralls && $(go env GOPATH)/bin/goveralls -v -coverprofile=coverage.out -service=github
    57  alpine_tests:
    58    name: Alpine Linux Platform Tests
    59    runs-on: ubuntu-latest
    60    container:
    61      image: golang:1.18-alpine
    62    steps:
    63      - uses: actions/checkout@v1
    64      - name: Set Up
    65        run: |
    66          apk add --upgrade gcc g++ && \
    67          adduser testuser -D
    68      - name: All Tests
    69        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 ./...'
    70  platform_tests:
    71    name: Platform tests
    72    strategy:
    73      matrix:
    74        os: [ ubuntu-latest, windows-latest, macos-11 ]
    75    runs-on: ${{ matrix.os }}
    76    steps:
    77      - name: Checkout
    78        uses: actions/checkout@v1
    79      - name: Set Up Golang
    80        uses: actions/setup-go@v3
    81        with:
    82          go-version: 1.18
    83      - name: Platform Tests
    84        run: |
    85          cd platform-test
    86          go test -v -race ./...

View as plain text