From 44fb276464f41852c475d1e31f9e4afcb81b1a1a Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 21 Jun 2020 21:28:59 +0200 Subject: [PATCH] workflow: execute tests using postgresql provider too --- .github/workflows/development.yml | 56 +++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 72fbc8c0..b62a93de 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -67,17 +67,18 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.14' }} run: | rm -f sftpgo.db - export SFTPGO_DATA_PROVIDER__DRIVER=bolt go test -v ./config -covermode=atomic go test -v ./httpd -covermode=atomic go test -v ./sftpd -covermode=atomic + env: + SFTPGO_DATA_PROVIDER__DRIVER: bolt - name: Run tests using memory provider if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.14' }} - run: | - export SFTPGO_DATA_PROVIDER__DRIVER=memory - export SFTPGO_DATA_PROVIDER__NAME= - go test -v ./... -covermode=atomic + run: go test -v ./... -covermode=atomic + env: + SFTPGO_DATA_PROVIDER__DRIVER: memory + SFTPGO_DATA_PROVIDER__NAME: test-deploy-windows: runs-on: windows-latest @@ -104,8 +105,8 @@ jobs: - name: Prepare artifact run: | mkdir output - xcopy.exe .\sftpgo.exe .\output - xcopy.exe .\sftpgo.json .\output + xcopy .\sftpgo.exe .\output + xcopy .\sftpgo.json .\output move .\templates .\output move .\static .\output @@ -114,3 +115,44 @@ jobs: with: name: sftpgo-windows path: output + + test-postgresql: + runs-on: ubuntu-latest + env: + SFTPGO_DATA_PROVIDER__DRIVER: postgresql + SFTPGO_DATA_PROVIDER__NAME: sftpgo + SFTPGO_DATA_PROVIDER__HOST: localhost + SFTPGO_DATA_PROVIDER__PORT: 5432 + SFTPGO_DATA_PROVIDER__USERNAME: postgres + SFTPGO_DATA_PROVIDER__PASSWORD: postgres + + services: + postgres: + image: postgres:latest + env: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: sftpgo + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - uses: actions/checkout@v2 + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + + - name: Build + run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo + + - name: Initialize data provider + run: ./sftpgo initprovider + + - name: Run tests using PostgreSQL provider + run: go test -v ./... -covermode=atomic