2020-06-28 19:01:03 +00:00
|
|
|
name: CI
|
2020-06-20 19:57:51 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-02-09 18:53:03 +00:00
|
|
|
branches: [main]
|
2020-06-20 19:57:51 +00:00
|
|
|
pull_request:
|
|
|
|
|
2020-06-28 13:57:33 +00:00
|
|
|
jobs:
|
2020-06-29 09:15:24 +00:00
|
|
|
test-deploy:
|
|
|
|
name: Test and deploy
|
2020-06-20 19:57:51 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-18 20:52:00 +00:00
|
|
|
go: [1.18]
|
2020-06-29 18:07:51 +00:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
upload-coverage: [true]
|
2020-06-20 19:57:51 +00:00
|
|
|
include:
|
2022-03-18 20:52:00 +00:00
|
|
|
- go: 1.18
|
|
|
|
os: windows-latest
|
2020-06-29 18:07:51 +00:00
|
|
|
upload-coverage: false
|
2020-06-20 19:57:51 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-03 11:44:56 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-09-26 12:07:24 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-06-20 19:57:51 +00:00
|
|
|
|
2020-06-29 09:15:24 +00:00
|
|
|
- name: Set up Go
|
2022-03-03 11:44:56 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-06-20 19:57:51 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2021-04-20 21:00:27 +00:00
|
|
|
- name: Build for Linux/macOS x86_64
|
2020-06-28 13:57:33 +00:00
|
|
|
if: startsWith(matrix.os, 'windows-') != true
|
2021-10-23 13:47:21 +00:00
|
|
|
run: |
|
|
|
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
|
cd tests/eventsearcher
|
|
|
|
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
|
|
|
cd -
|
2022-03-23 09:58:01 +00:00
|
|
|
cd tests/ipfilter
|
|
|
|
go build -trimpath -ldflags "-s -w" -o ipfilter
|
|
|
|
cd -
|
2020-06-20 19:57:51 +00:00
|
|
|
|
2021-04-20 21:00:27 +00:00
|
|
|
- name: Build for macOS arm64
|
|
|
|
if: startsWith(matrix.os, 'macos-') == true
|
2021-06-26 05:31:41 +00:00
|
|
|
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
2021-04-20 21:00:27 +00:00
|
|
|
|
2020-06-29 09:15:24 +00:00
|
|
|
- name: Build for Windows
|
2020-06-28 13:57:33 +00:00
|
|
|
if: startsWith(matrix.os, 'windows-')
|
|
|
|
run: |
|
|
|
|
$GIT_COMMIT = (git describe --always --dirty) | Out-String
|
|
|
|
$DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
|
2021-10-23 17:27:39 +00:00
|
|
|
$LATEST_TAG = ((git describe --tags $(git rev-list --tags --max-count=1)) | Out-String).Trim()
|
|
|
|
$REV_LIST=$LATEST_TAG+"..HEAD"
|
|
|
|
$COMMITS_FROM_TAG= ((git rev-list $REV_LIST --count) | Out-String).Trim()
|
|
|
|
$FILE_VERSION = $LATEST_TAG.substring(1) + "." + $COMMITS_FROM_TAG
|
|
|
|
go install github.com/tc-hib/go-winres@latest
|
|
|
|
go-winres simply --arch amd64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
2021-06-26 05:31:41 +00:00
|
|
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o sftpgo.exe
|
2021-10-23 13:47:21 +00:00
|
|
|
cd tests/eventsearcher
|
|
|
|
go build -trimpath -ldflags "-s -w" -o eventsearcher.exe
|
|
|
|
cd ../..
|
2022-03-23 09:58:01 +00:00
|
|
|
cd tests/ipfilter
|
|
|
|
go build -trimpath -ldflags "-s -w" -o ipfilter.exe
|
|
|
|
cd ../..
|
2021-11-28 17:56:30 +00:00
|
|
|
mkdir arm64
|
|
|
|
$Env:CGO_ENABLED='0'
|
|
|
|
$Env:GOOS='windows'
|
|
|
|
$Env:GOARCH='arm64'
|
|
|
|
go-winres simply --arch arm64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
|
|
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
|
2021-11-28 20:30:31 +00:00
|
|
|
mkdir x86
|
|
|
|
$Env:GOARCH='386'
|
|
|
|
go-winres simply --arch 386 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
|
|
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
|
2021-11-28 17:56:30 +00:00
|
|
|
Remove-Item Env:\CGO_ENABLED
|
|
|
|
Remove-Item Env:\GOOS
|
|
|
|
Remove-Item Env:\GOARCH
|
2020-06-28 13:57:33 +00:00
|
|
|
|
2020-06-22 21:47:07 +00:00
|
|
|
- name: Run test cases using SQLite provider
|
2021-09-29 16:46:15 +00:00
|
|
|
run: go test -v -p 1 -timeout 15m ./... -coverprofile=coverage.txt -covermode=atomic
|
2020-06-20 19:57:51 +00:00
|
|
|
|
2020-06-29 09:15:24 +00:00
|
|
|
- name: Upload coverage to Codecov
|
2020-06-29 18:07:51 +00:00
|
|
|
if: ${{ matrix.upload-coverage }}
|
2022-04-11 07:24:54 +00:00
|
|
|
uses: codecov/codecov-action@v3
|
2020-06-20 19:57:51 +00:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
2020-06-22 21:47:07 +00:00
|
|
|
fail_ci_if_error: false
|
2020-06-20 19:57:51 +00:00
|
|
|
|
2020-06-22 21:47:07 +00:00
|
|
|
- name: Run test cases using bolt provider
|
2020-06-20 21:49:27 +00:00
|
|
|
run: |
|
2020-08-22 08:12:00 +00:00
|
|
|
go test -v -p 1 -timeout 2m ./config -covermode=atomic
|
2021-05-07 18:41:20 +00:00
|
|
|
go test -v -p 1 -timeout 5m ./common -covermode=atomic
|
|
|
|
go test -v -p 1 -timeout 5m ./httpd -covermode=atomic
|
2020-08-22 08:12:00 +00:00
|
|
|
go test -v -p 1 -timeout 8m ./sftpd -covermode=atomic
|
2021-05-07 18:41:20 +00:00
|
|
|
go test -v -p 1 -timeout 5m ./ftpd -covermode=atomic
|
|
|
|
go test -v -p 1 -timeout 5m ./webdavd -covermode=atomic
|
2020-12-18 15:04:42 +00:00
|
|
|
go test -v -p 1 -timeout 2m ./telemetry -covermode=atomic
|
2021-09-04 10:11:04 +00:00
|
|
|
go test -v -p 1 -timeout 2m ./mfa -covermode=atomic
|
2022-05-20 17:30:54 +00:00
|
|
|
go test -v -p 1 -timeout 2m ./command -covermode=atomic
|
2020-06-21 19:28:59 +00:00
|
|
|
env:
|
|
|
|
SFTPGO_DATA_PROVIDER__DRIVER: bolt
|
2020-06-22 21:47:07 +00:00
|
|
|
SFTPGO_DATA_PROVIDER__NAME: 'sftpgo_bolt.db'
|
2020-06-20 21:49:27 +00:00
|
|
|
|
2020-06-22 21:47:07 +00:00
|
|
|
- name: Run test cases using memory provider
|
2021-09-29 16:46:15 +00:00
|
|
|
run: go test -v -p 1 -timeout 15m ./... -covermode=atomic
|
2020-06-21 19:28:59 +00:00
|
|
|
env:
|
2020-06-28 13:57:33 +00:00
|
|
|
SFTPGO_DATA_PROVIDER__DRIVER: memory
|
|
|
|
SFTPGO_DATA_PROVIDER__NAME: ''
|
2020-06-20 19:57:51 +00:00
|
|
|
|
2021-04-07 13:12:09 +00:00
|
|
|
- name: Prepare build artifact for macOS
|
|
|
|
if: startsWith(matrix.os, 'macos-') == true
|
2020-11-08 05:14:03 +00:00
|
|
|
run: |
|
2021-04-07 13:12:09 +00:00
|
|
|
mkdir -p output/{init,bash_completion,zsh_completion}
|
2021-04-20 21:00:27 +00:00
|
|
|
cp sftpgo output/sftpgo_x86_64
|
|
|
|
cp sftpgo_arm64 output/
|
2020-06-28 13:57:33 +00:00
|
|
|
cp sftpgo.json output/
|
|
|
|
cp -r templates output/
|
|
|
|
cp -r static output/
|
2021-11-21 08:32:51 +00:00
|
|
|
cp -r openapi output/
|
2021-04-07 13:12:09 +00:00
|
|
|
cp init/com.github.drakkan.sftpgo.plist output/init/
|
2020-10-08 14:02:04 +00:00
|
|
|
./sftpgo gen completion bash > output/bash_completion/sftpgo
|
2020-07-10 21:31:53 +00:00
|
|
|
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
|
|
|
|
./sftpgo gen man -d output/man/man1
|
|
|
|
gzip output/man/man1/*
|
2020-11-09 17:39:36 +00:00
|
|
|
|
2021-10-23 17:27:39 +00:00
|
|
|
- name: Prepare Windows installer
|
2021-11-19 21:44:50 +00:00
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }}
|
2021-10-23 17:27:39 +00:00
|
|
|
run: |
|
|
|
|
Remove-Item -LiteralPath "output" -Force -Recurse -ErrorAction Ignore
|
|
|
|
mkdir output
|
|
|
|
copy .\sftpgo.exe .\output
|
|
|
|
copy .\sftpgo.json .\output
|
|
|
|
copy .\sftpgo.db .\output
|
|
|
|
copy .\LICENSE .\output\LICENSE.txt
|
|
|
|
mkdir output\templates
|
|
|
|
xcopy .\templates .\output\templates\ /E
|
|
|
|
mkdir output\static
|
|
|
|
xcopy .\static .\output\static\ /E
|
2021-11-21 08:32:51 +00:00
|
|
|
mkdir output\openapi
|
|
|
|
xcopy .\openapi .\output\openapi\ /E
|
2021-10-23 17:27:39 +00:00
|
|
|
$LATEST_TAG = ((git describe --tags $(git rev-list --tags --max-count=1)) | Out-String).Trim()
|
|
|
|
$REV_LIST=$LATEST_TAG+"..HEAD"
|
|
|
|
$COMMITS_FROM_TAG= ((git rev-list $REV_LIST --count) | Out-String).Trim()
|
|
|
|
$Env:SFTPGO_ISS_DEV_VERSION = $LATEST_TAG + "." + $COMMITS_FROM_TAG
|
2021-11-19 21:44:50 +00:00
|
|
|
$CERT_PATH=(Get-Location -PSProvider FileSystem).ProviderPath + "\cert.pfx"
|
|
|
|
[IO.File]::WriteAllBytes($CERT_PATH,[System.Convert]::FromBase64String($Env:CERT_DATA))
|
|
|
|
certutil -f -p "$Env:CERT_PASS" -importpfx MY "$CERT_PATH"
|
|
|
|
rm "$CERT_PATH"
|
2022-03-18 20:52:00 +00:00
|
|
|
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\sftpgo.exe
|
|
|
|
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\arm64\sftpgo.exe
|
|
|
|
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\x86\sftpgo.exe
|
|
|
|
$INNO_S='/Ssigntool=$qC:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe$q sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n $qNicola Murino$q /d $qSFTPGo$q $f'
|
2021-11-21 08:32:51 +00:00
|
|
|
iscc "$INNO_S" .\windows-installer\sftpgo.iss
|
2021-11-28 17:56:30 +00:00
|
|
|
|
|
|
|
rm .\output\sftpgo.exe
|
|
|
|
rm .\output\sftpgo.db
|
|
|
|
copy .\arm64\sftpgo.exe .\output
|
|
|
|
(Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json
|
|
|
|
$Env:SFTPGO_DATA_PROVIDER__DRIVER='bolt'
|
|
|
|
$Env:SFTPGO_DATA_PROVIDER__NAME='.\output\sftpgo.db'
|
|
|
|
.\sftpgo.exe initprovider
|
|
|
|
Remove-Item Env:\SFTPGO_DATA_PROVIDER__DRIVER
|
|
|
|
Remove-Item Env:\SFTPGO_DATA_PROVIDER__NAME
|
|
|
|
$Env:SFTPGO_ISS_ARCH='arm64'
|
|
|
|
iscc "$INNO_S" .\windows-installer\sftpgo.iss
|
2021-11-28 20:30:31 +00:00
|
|
|
|
|
|
|
rm .\output\sftpgo.exe
|
|
|
|
copy .\x86\sftpgo.exe .\output
|
|
|
|
$Env:SFTPGO_ISS_ARCH='x86'
|
|
|
|
iscc "$INNO_S" .\windows-installer\sftpgo.iss
|
2021-11-19 21:44:50 +00:00
|
|
|
certutil -delstore MY "Nicola Murino"
|
|
|
|
env:
|
|
|
|
CERT_DATA: ${{ secrets.CERT_DATA }}
|
|
|
|
CERT_PASS: ${{ secrets.CERT_PASS }}
|
2021-10-23 17:27:39 +00:00
|
|
|
|
2021-11-28 17:56:30 +00:00
|
|
|
- name: Upload Windows installer x86_64 artifact
|
2021-11-19 21:44:50 +00:00
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }}
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-10-23 17:27:39 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo_windows_installer_x86_64
|
|
|
|
path: ./sftpgo_windows_x86_64.exe
|
|
|
|
|
2021-11-28 17:56:30 +00:00
|
|
|
- name: Upload Windows installer arm64 artifact
|
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }}
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-11-28 17:56:30 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo_windows_installer_arm64
|
|
|
|
path: ./sftpgo_windows_arm64.exe
|
|
|
|
|
2021-11-28 20:30:31 +00:00
|
|
|
- name: Upload Windows installer x86 artifact
|
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }}
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-11-28 20:30:31 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo_windows_installer_x86
|
|
|
|
path: ./sftpgo_windows_x86.exe
|
|
|
|
|
2021-11-21 08:32:51 +00:00
|
|
|
- name: Prepare build artifact for Windows
|
|
|
|
if: startsWith(matrix.os, 'windows-')
|
|
|
|
run: |
|
|
|
|
Remove-Item -LiteralPath "output" -Force -Recurse -ErrorAction Ignore
|
|
|
|
mkdir output
|
|
|
|
copy .\sftpgo.exe .\output
|
2021-11-28 17:56:30 +00:00
|
|
|
mkdir output\arm64
|
|
|
|
copy .\arm64\sftpgo.exe .\output\arm64
|
2021-11-28 20:30:31 +00:00
|
|
|
mkdir output\x86
|
|
|
|
copy .\x86\sftpgo.exe .\output\x86
|
2021-11-21 08:32:51 +00:00
|
|
|
copy .\sftpgo.json .\output
|
2021-11-28 17:56:30 +00:00
|
|
|
(Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json
|
2021-11-21 08:32:51 +00:00
|
|
|
mkdir output\templates
|
|
|
|
xcopy .\templates .\output\templates\ /E
|
|
|
|
mkdir output\static
|
|
|
|
xcopy .\static .\output\static\ /E
|
|
|
|
mkdir output\openapi
|
|
|
|
xcopy .\openapi .\output\openapi\ /E
|
|
|
|
|
|
|
|
- name: Upload build artifact
|
|
|
|
if: startsWith(matrix.os, 'ubuntu-') != true
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-11-21 08:32:51 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo-${{ matrix.os }}-go-${{ matrix.go }}
|
|
|
|
path: output
|
|
|
|
|
2021-08-28 10:03:23 +00:00
|
|
|
test-goarch-386:
|
2021-09-29 16:46:15 +00:00
|
|
|
name: Run test cases on 32-bit arch
|
2021-08-28 10:03:23 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-03-03 11:44:56 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-08-28 10:03:23 +00:00
|
|
|
|
|
|
|
- name: Set up Go
|
2022-03-03 11:44:56 +00:00
|
|
|
uses: actions/setup-go@v3
|
2021-08-28 10:03:23 +00:00
|
|
|
with:
|
2022-03-18 20:52:00 +00:00
|
|
|
go-version: 1.18
|
2021-08-28 10:03:23 +00:00
|
|
|
|
|
|
|
- name: Build
|
2021-10-23 13:47:21 +00:00
|
|
|
run: |
|
|
|
|
cd tests/eventsearcher
|
|
|
|
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
|
|
|
cd -
|
2022-03-23 09:58:01 +00:00
|
|
|
cd tests/ipfilter
|
|
|
|
go build -trimpath -ldflags "-s -w" -o ipfilter
|
|
|
|
cd -
|
2021-08-28 10:03:23 +00:00
|
|
|
env:
|
|
|
|
GOARCH: 386
|
|
|
|
|
2021-09-04 10:11:04 +00:00
|
|
|
- name: Run test cases
|
2021-09-29 16:46:15 +00:00
|
|
|
run: go test -v -p 1 -timeout 15m ./... -covermode=atomic
|
2021-08-28 10:03:23 +00:00
|
|
|
env:
|
|
|
|
SFTPGO_DATA_PROVIDER__DRIVER: memory
|
|
|
|
SFTPGO_DATA_PROVIDER__NAME: ''
|
|
|
|
GOARCH: 386
|
|
|
|
|
2021-03-23 18:14:15 +00:00
|
|
|
test-postgresql-mysql-crdb:
|
|
|
|
name: Test with PgSQL/MySQL/Cockroach
|
2020-06-21 19:28:59 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-06-22 18:02:51 +00:00
|
|
|
mariadb:
|
|
|
|
image: mariadb:latest
|
|
|
|
env:
|
|
|
|
MYSQL_ROOT_PASSWORD: mysql
|
|
|
|
MYSQL_DATABASE: sftpgo
|
|
|
|
MYSQL_USER: sftpgo
|
|
|
|
MYSQL_PASSWORD: sftpgo
|
|
|
|
options: >-
|
|
|
|
--health-cmd "mysqladmin status -h 127.0.0.1 -P 3306 -u root -p$MYSQL_ROOT_PASSWORD"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 6
|
|
|
|
ports:
|
|
|
|
- 3307:3306
|
|
|
|
|
2020-06-21 19:28:59 +00:00
|
|
|
steps:
|
2022-03-03 11:44:56 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-06-21 19:28:59 +00:00
|
|
|
|
2020-06-29 09:15:24 +00:00
|
|
|
- name: Set up Go
|
2022-03-03 11:44:56 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-06-21 19:28:59 +00:00
|
|
|
with:
|
2022-03-18 20:52:00 +00:00
|
|
|
go-version: 1.18
|
2020-06-21 19:28:59 +00:00
|
|
|
|
|
|
|
- name: Build
|
2021-10-23 13:47:21 +00:00
|
|
|
run: |
|
|
|
|
cd tests/eventsearcher
|
|
|
|
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
|
|
|
cd -
|
2022-03-23 09:58:01 +00:00
|
|
|
cd tests/ipfilter
|
|
|
|
go build -trimpath -ldflags "-s -w" -o ipfilter
|
|
|
|
cd -
|
2020-06-21 19:28:59 +00:00
|
|
|
|
|
|
|
- name: Run tests using PostgreSQL provider
|
2020-06-22 18:02:51 +00:00
|
|
|
run: |
|
2021-09-29 16:46:15 +00:00
|
|
|
go test -v -p 1 -timeout 15m ./... -covermode=atomic
|
2020-06-22 18:02:51 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
- name: Run tests using MySQL provider
|
|
|
|
run: |
|
2021-09-29 16:46:15 +00:00
|
|
|
go test -v -p 1 -timeout 15m ./... -covermode=atomic
|
2020-06-22 18:02:51 +00:00
|
|
|
env:
|
|
|
|
SFTPGO_DATA_PROVIDER__DRIVER: mysql
|
|
|
|
SFTPGO_DATA_PROVIDER__NAME: sftpgo
|
|
|
|
SFTPGO_DATA_PROVIDER__HOST: localhost
|
|
|
|
SFTPGO_DATA_PROVIDER__PORT: 3307
|
|
|
|
SFTPGO_DATA_PROVIDER__USERNAME: sftpgo
|
|
|
|
SFTPGO_DATA_PROVIDER__PASSWORD: sftpgo
|
2020-06-28 13:57:33 +00:00
|
|
|
|
2021-03-23 18:14:15 +00:00
|
|
|
- name: Run tests using CockroachDB provider
|
|
|
|
run: |
|
2021-03-26 14:19:01 +00:00
|
|
|
docker run --rm --name crdb --health-cmd "curl -I http://127.0.0.1:8080" --health-interval 10s --health-timeout 5s --health-retries 6 -p 26257:26257 -d cockroachdb/cockroach:latest start-single-node --insecure --listen-addr 0.0.0.0:26257
|
2021-03-23 18:14:15 +00:00
|
|
|
docker exec crdb cockroach sql --insecure -e 'create database "sftpgo"'
|
2021-09-29 16:46:15 +00:00
|
|
|
go test -v -p 1 -timeout 15m ./... -covermode=atomic
|
2021-03-23 18:14:15 +00:00
|
|
|
docker stop crdb
|
|
|
|
env:
|
2021-03-27 18:41:00 +00:00
|
|
|
SFTPGO_DATA_PROVIDER__DRIVER: cockroachdb
|
2021-03-23 18:14:15 +00:00
|
|
|
SFTPGO_DATA_PROVIDER__NAME: sftpgo
|
|
|
|
SFTPGO_DATA_PROVIDER__HOST: localhost
|
|
|
|
SFTPGO_DATA_PROVIDER__PORT: 26257
|
|
|
|
SFTPGO_DATA_PROVIDER__USERNAME: root
|
|
|
|
SFTPGO_DATA_PROVIDER__PASSWORD:
|
|
|
|
|
2021-04-07 13:12:09 +00:00
|
|
|
build-linux-packages:
|
|
|
|
name: Build Linux packages
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- arch: amd64
|
2022-03-18 20:52:00 +00:00
|
|
|
go: 1.18
|
2021-04-07 13:12:09 +00:00
|
|
|
go-arch: amd64
|
|
|
|
- arch: aarch64
|
|
|
|
distro: ubuntu18.04
|
|
|
|
go: latest
|
|
|
|
go-arch: arm64
|
|
|
|
- arch: ppc64le
|
|
|
|
distro: ubuntu18.04
|
|
|
|
go: latest
|
|
|
|
go-arch: ppc64le
|
2021-09-25 12:14:21 +00:00
|
|
|
- arch: armv7
|
|
|
|
distro: ubuntu18.04
|
|
|
|
go: latest
|
2021-11-14 15:23:33 +00:00
|
|
|
go-arch: arm7
|
2021-04-07 13:12:09 +00:00
|
|
|
steps:
|
2022-03-03 11:44:56 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-04-07 13:12:09 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
|
|
if: ${{ matrix.arch == 'amd64' }}
|
2022-03-03 11:44:56 +00:00
|
|
|
uses: actions/setup-go@v3
|
2021-04-07 13:12:09 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Build on amd64
|
|
|
|
if: ${{ matrix.arch == 'amd64' }}
|
|
|
|
run: |
|
2021-06-26 05:31:41 +00:00
|
|
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
2021-04-07 13:12:09 +00:00
|
|
|
mkdir -p output/{init,bash_completion,zsh_completion}
|
|
|
|
cp sftpgo.json output/
|
|
|
|
cp -r templates output/
|
|
|
|
cp -r static output/
|
2021-11-21 08:32:51 +00:00
|
|
|
cp -r openapi output/
|
2021-04-07 13:12:09 +00:00
|
|
|
cp init/sftpgo.service output/init/
|
|
|
|
./sftpgo gen completion bash > output/bash_completion/sftpgo
|
|
|
|
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
|
|
|
|
./sftpgo gen man -d output/man/man1
|
|
|
|
gzip output/man/man1/*
|
|
|
|
cp sftpgo output/
|
|
|
|
|
2022-03-24 21:03:17 +00:00
|
|
|
- uses: uraimo/run-on-arch-action@v2
|
2021-04-07 13:12:09 +00:00
|
|
|
if: ${{ matrix.arch != 'amd64' }}
|
|
|
|
name: Build for ${{ matrix.arch }}
|
|
|
|
id: build
|
|
|
|
with:
|
|
|
|
arch: ${{ matrix.arch }}
|
|
|
|
distro: ${{ matrix.distro }}
|
|
|
|
setup: |
|
|
|
|
mkdir -p "${PWD}/output"
|
|
|
|
dockerRunArgs: |
|
|
|
|
--volume "${PWD}/output:/output"
|
|
|
|
shell: /bin/bash
|
|
|
|
install: |
|
|
|
|
apt-get update -q -y
|
|
|
|
apt-get install -q -y curl gcc git
|
|
|
|
if [ ${{ matrix.go }} == 'latest' ]
|
|
|
|
then
|
2021-11-24 10:27:32 +00:00
|
|
|
GO_VERSION=$(curl -L https://go.dev/VERSION?m=text)
|
2021-04-07 13:12:09 +00:00
|
|
|
else
|
|
|
|
GO_VERSION=${{ matrix.go }}
|
|
|
|
fi
|
2021-09-25 12:14:21 +00:00
|
|
|
GO_DOWNLOAD_ARCH=${{ matrix.go-arch }}
|
|
|
|
if [ ${{ matrix.arch}} == 'armv7' ]
|
|
|
|
then
|
|
|
|
GO_DOWNLOAD_ARCH=armv6l
|
|
|
|
fi
|
2021-11-24 10:27:32 +00:00
|
|
|
curl --retry 5 --retry-delay 2 --connect-timeout 10 -o go.tar.gz -L https://go.dev/dl/${GO_VERSION}.linux-${GO_DOWNLOAD_ARCH}.tar.gz
|
2021-04-07 13:12:09 +00:00
|
|
|
tar -C /usr/local -xzf go.tar.gz
|
|
|
|
run: |
|
|
|
|
export PATH=$PATH:/usr/local/go/bin
|
2021-09-25 12:14:21 +00:00
|
|
|
if [ ${{ matrix.arch}} == 'armv7' ]
|
|
|
|
then
|
|
|
|
export GOARM=7
|
|
|
|
fi
|
2022-04-13 08:25:29 +00:00
|
|
|
go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
2021-04-07 13:12:09 +00:00
|
|
|
mkdir -p output/{init,bash_completion,zsh_completion}
|
|
|
|
cp sftpgo.json output/
|
|
|
|
cp -r templates output/
|
|
|
|
cp -r static output/
|
2021-11-21 08:32:51 +00:00
|
|
|
cp -r openapi output/
|
2021-04-07 13:12:09 +00:00
|
|
|
cp init/sftpgo.service output/init/
|
|
|
|
./sftpgo gen completion bash > output/bash_completion/sftpgo
|
|
|
|
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
|
|
|
|
./sftpgo gen man -d output/man/man1
|
|
|
|
gzip output/man/man1/*
|
|
|
|
cp sftpgo output/
|
|
|
|
|
|
|
|
- name: Upload build artifact
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-04-07 13:12:09 +00:00
|
|
|
with:
|
2021-04-08 19:29:09 +00:00
|
|
|
name: sftpgo-linux-${{ matrix.arch }}-go-${{ matrix.go }}
|
2021-04-07 13:12:09 +00:00
|
|
|
path: output
|
|
|
|
|
|
|
|
- name: Build Packages
|
|
|
|
id: build_linux_pkgs
|
|
|
|
run: |
|
|
|
|
export NFPM_ARCH=${{ matrix.go-arch }}
|
|
|
|
cd pkgs
|
|
|
|
./build.sh
|
|
|
|
PKG_VERSION=$(cat dist/version)
|
|
|
|
echo "::set-output name=pkg-version::${PKG_VERSION}"
|
|
|
|
|
|
|
|
- name: Upload Debian Package
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-04-07 13:12:09 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-${{ matrix.go-arch }}-deb
|
|
|
|
path: pkgs/dist/deb/*
|
|
|
|
|
|
|
|
- name: Upload RPM Package
|
2022-03-24 09:21:13 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-04-07 13:12:09 +00:00
|
|
|
with:
|
|
|
|
name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-${{ matrix.go-arch }}-rpm
|
|
|
|
path: pkgs/dist/rpm/*
|
|
|
|
|
2020-06-28 13:57:33 +00:00
|
|
|
golangci-lint:
|
|
|
|
name: golangci-lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-02-25 10:51:10 +00:00
|
|
|
- name: Set up Go
|
2022-03-03 11:44:56 +00:00
|
|
|
uses: actions/setup-go@v3
|
2022-02-25 10:51:10 +00:00
|
|
|
with:
|
2022-03-18 20:52:00 +00:00
|
|
|
go-version: 1.18
|
2022-03-03 11:44:56 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-06-28 13:57:33 +00:00
|
|
|
- name: Run golangci-lint
|
2022-02-25 10:51:10 +00:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2020-06-28 13:57:33 +00:00
|
|
|
with:
|
2020-10-14 05:46:36 +00:00
|
|
|
version: latest
|