From 916e53cf9a1c3835ebd1ba76365167a2a8f9d25f Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 18 Dec 2022 15:21:32 +0100 Subject: [PATCH] CI: add nosqlite build tag when CGO is disabled Signed-off-by: Nicola Murino --- .github/workflows/development.yml | 4 ++-- .github/workflows/docker.yml | 5 ++++- .github/workflows/release.yml | 6 +++--- Dockerfile.distroless | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 404ab4c4..bf668f26 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -69,11 +69,11 @@ jobs: $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 -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 $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 -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:\GOOS Remove-Item Env:\GOARCH diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cc4ba177..8add4d87 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -42,6 +42,7 @@ jobs: DOCKERFILE=Dockerfile MINOR="" MAJOR="" + FEATURES="nopgxregisterdefaulttypes" if [ "${{ github.event_name }}" = "schedule" ]; then VERSION=nightly elif [[ $GITHUB_REF == refs/tags/* ]]; then @@ -67,6 +68,7 @@ jobs: VERSION="${VERSION}-distroless" VERSION_SLIM="${VERSION}-slim" DOCKERFILE=Dockerfile.distroless + FEATURES="${FEATURES},nosqlite" elif [[ $DOCKER_PKG == debian-plugins ]]; then VERSION="${VERSION}-plugins" VERSION_SLIM="${VERSION}-slim" @@ -128,6 +130,7 @@ jobs: echo "plugins=false" >> $GITHUB_OUTPUT fi echo "dockerfile=${DOCKERFILE}" >> $GITHUB_OUTPUT + echo "features=${FEATURES}" >> $GITHUB_OUTPUT echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT env: @@ -169,7 +172,7 @@ jobs: COMMIT_SHA=${{ steps.info.outputs.sha }} INSTALL_OPTIONAL_PACKAGES=${{ steps.info.outputs.full }} DOWNLOAD_PLUGINS=${{ steps.info.outputs.plugins }} - FEATURES=nopgxregisterdefaulttypes + FEATURES=${{ steps.info.outputs.features }} labels: | org.opencontainers.image.title=SFTPGo org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 048c5e30..d81ce105 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: tags: 'v*' env: - GO_VERSION: 1.19.3 + GO_VERSION: 1.19.4 jobs: prepare-sources-with-deps: @@ -92,11 +92,11 @@ jobs: $Env:GOOS='windows' $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 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 $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 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:\GOOS Remove-Item Env:\GOARCH diff --git a/Dockerfile.distroless b/Dockerfile.distroless index 92def6d8..20d32886 100644 --- a/Dockerfile.distroless +++ b/Dockerfile.distroless @@ -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. # For this variant we disable SQLite support since it requires CGO and so a C runtime which is not installed # in distroless/static-* images -ARG FEATURES=nosqlite +ARG FEATURES COPY . .