mirror of
https://github.com/drakkan/sftpgo.git
synced 2026-03-23 02:04:38 +01:00
158 lines
4.4 KiB
YAML
158 lines
4.4 KiB
YAML
name: Development Workflow
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
|
|
jobs:
|
|
golangci-lint:
|
|
name: golangci-lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v1
|
|
with:
|
|
version: v1.27
|
|
|
|
test-deploy-unix:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go: [1.14]
|
|
os: [ubuntu-latest, macos-latest]
|
|
include:
|
|
- go: 1.13
|
|
os: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- 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 SQLite provider
|
|
run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic
|
|
|
|
- name: Upload to Codecov
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
file: ./coverage.txt
|
|
fail_ci_if_error: true
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
mkdir output
|
|
cp sftpgo output/
|
|
cp sftpgo.json output/
|
|
cp -r templates output/
|
|
cp -r static output/
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: sftpgo-${{ matrix.os }}-go${{ matrix.go }}
|
|
path: output
|
|
|
|
- name: Run tests using bolt provider
|
|
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.14' }}
|
|
run: |
|
|
rm -f sftpgo.db
|
|
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: go test -v ./... -covermode=atomic
|
|
env:
|
|
SFTPGO_DATA_PROVIDER__DRIVER: memory
|
|
SFTPGO_DATA_PROVIDER__NAME:
|
|
|
|
test-deploy-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.14
|
|
|
|
- name: Build
|
|
run: |
|
|
$GIT_COMMIT = (git describe --always --dirty) | Out-String
|
|
$DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
|
|
go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
|
|
|
|
- name: Initialize data provider
|
|
run: .\sftpgo.exe initprovider
|
|
|
|
- name: Run tests
|
|
run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
mkdir output
|
|
xcopy .\sftpgo.exe .\output
|
|
xcopy .\sftpgo.json .\output
|
|
move .\templates .\output
|
|
move .\static .\output
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
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
|