CI: add nosqlite build tag when CGO is disabled

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2022-12-18 15:21:32 +01:00
parent 5f35b8b704
commit 916e53cf9a
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
4 changed files with 10 additions and 7 deletions

View file

@ -69,11 +69,11 @@ jobs:
$Env:GOOS='windows' $Env:GOOS='windows'
$Env:GOARCH='arm64' $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-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 -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
mkdir x86 mkdir x86
$Env:GOARCH='386' $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-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 -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
Remove-Item Env:\CGO_ENABLED Remove-Item Env:\CGO_ENABLED
Remove-Item Env:\GOOS Remove-Item Env:\GOOS
Remove-Item Env:\GOARCH Remove-Item Env:\GOARCH

View file

@ -42,6 +42,7 @@ jobs:
DOCKERFILE=Dockerfile DOCKERFILE=Dockerfile
MINOR="" MINOR=""
MAJOR="" MAJOR=""
FEATURES="nopgxregisterdefaulttypes"
if [ "${{ github.event_name }}" = "schedule" ]; then if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly VERSION=nightly
elif [[ $GITHUB_REF == refs/tags/* ]]; then elif [[ $GITHUB_REF == refs/tags/* ]]; then
@ -67,6 +68,7 @@ jobs:
VERSION="${VERSION}-distroless" VERSION="${VERSION}-distroless"
VERSION_SLIM="${VERSION}-slim" VERSION_SLIM="${VERSION}-slim"
DOCKERFILE=Dockerfile.distroless DOCKERFILE=Dockerfile.distroless
FEATURES="${FEATURES},nosqlite"
elif [[ $DOCKER_PKG == debian-plugins ]]; then elif [[ $DOCKER_PKG == debian-plugins ]]; then
VERSION="${VERSION}-plugins" VERSION="${VERSION}-plugins"
VERSION_SLIM="${VERSION}-slim" VERSION_SLIM="${VERSION}-slim"
@ -128,6 +130,7 @@ jobs:
echo "plugins=false" >> $GITHUB_OUTPUT echo "plugins=false" >> $GITHUB_OUTPUT
fi fi
echo "dockerfile=${DOCKERFILE}" >> $GITHUB_OUTPUT echo "dockerfile=${DOCKERFILE}" >> $GITHUB_OUTPUT
echo "features=${FEATURES}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
env: env:
@ -169,7 +172,7 @@ jobs:
COMMIT_SHA=${{ steps.info.outputs.sha }} COMMIT_SHA=${{ steps.info.outputs.sha }}
INSTALL_OPTIONAL_PACKAGES=${{ steps.info.outputs.full }} INSTALL_OPTIONAL_PACKAGES=${{ steps.info.outputs.full }}
DOWNLOAD_PLUGINS=${{ steps.info.outputs.plugins }} DOWNLOAD_PLUGINS=${{ steps.info.outputs.plugins }}
FEATURES=nopgxregisterdefaulttypes FEATURES=${{ steps.info.outputs.features }}
labels: | labels: |
org.opencontainers.image.title=SFTPGo org.opencontainers.image.title=SFTPGo
org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support

View file

@ -5,7 +5,7 @@ on:
tags: 'v*' tags: 'v*'
env: env:
GO_VERSION: 1.19.3 GO_VERSION: 1.19.4
jobs: jobs:
prepare-sources-with-deps: prepare-sources-with-deps:
@ -92,11 +92,11 @@ jobs:
$Env:GOOS='windows' $Env:GOOS='windows'
$Env:GOARCH='arm64' $Env:GOARCH='arm64'
go-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$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-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$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 -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
mkdir x86 mkdir x86
$Env:GOARCH='386' $Env:GOARCH='386'
go-winres simply --arch 386 --product-version $Env:SFTPGO_VERSION-$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-winres simply --arch 386 --product-version $Env:SFTPGO_VERSION-$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 -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
Remove-Item Env:\CGO_ENABLED Remove-Item Env:\CGO_ENABLED
Remove-Item Env:\GOOS Remove-Item Env:\GOOS
Remove-Item Env:\GOARCH Remove-Item Env:\GOARCH

View file

@ -15,7 +15,7 @@ ARG COMMIT_SHA
# This ARG allows to disable some optional features and it might be useful if you build the image yourself. # This ARG allows to disable some optional features and it might be useful if you build the image yourself.
# For this variant we disable SQLite support since it requires CGO and so a C runtime which is not installed # For this variant we disable SQLite support since it requires CGO and so a C runtime which is not installed
# in distroless/static-* images # in distroless/static-* images
ARG FEATURES=nosqlite ARG FEATURES
COPY . . COPY . .