Skip to content

update deps and workflows #33

update deps and workflows

update deps and workflows #33

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
env:
GO_VERSION: '1.22'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y osslsigncode
go install github.com/tc-hib/go-winres@latest
GIT_COMMIT=`git describe --always --dirty`
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
NUM_COMMITS_FROM_TAG=$(git rev-list ${LATEST_TAG}.. --count)
VERSION=$(echo "${LATEST_TAG}" | awk -F. -v OFS=. '{$NF++;print}')-dev.${NUM_COMMITS_FROM_TAG}
FILE_VERSION=${LATEST_TAG:1}.${NUM_COMMITS_FROM_TAG}
mkdir bin
go-winres simply --arch amd64 --product-version $VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo plugin eventsearch" --product-name "SFTPGo plugin eventsearch" --copyright "AGPL-3.0" --original-filename sftpgo-plugin-eventsearch-windows-x86_64.exe --icon res/icon.ico
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o sftpgo-plugin-eventsearch-windows-x86_64.exe
go-winres simply --arch arm64 --product-version $VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo plugin eventsearch" --product-name "SFTPGo plugin eventsearch" --copyright "AGPL-3.0" --original-filename sftpgo-plugin-eventsearch-windows-arm64.exe --icon res/icon.ico
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o sftpgo-plugin-eventsearch-windows-arm64.exe
go-winres simply --arch 386 --product-version $VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo plugin eventsearch" --product-name "SFTPGo plugin eventsearch" --copyright "AGPL-3.0" --original-filename sftpgo-plugin-eventsearch-windows-x86.exe --icon res/icon.ico
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o sftpgo-plugin-eventsearch-windows-x86.exe
if [ "${{ github.event_name }}" = "pull_request" ]; then
mv sftpgo-plugin-eventsearch-windows-x86_64.exe bin/
mv sftpgo-plugin-eventsearch-windows-arm64.exe bin/
mv sftpgo-plugin-eventsearch-windows-x86.exe bin/
else
echo $CERT_DATA | base64 --decode > cert.pfx
osslsigncode sign -pkcs12 cert.pfx -pass $CERT_PASS -n "SFTPGo plugin eventsearch" -i "https://github.com/sftpgo/sftpgo-plugin-eventsearch" -ts "http://timestamp.sectigo.com" -h sha2 -in sftpgo-plugin-eventsearch-windows-x86_64.exe -out bin/sftpgo-plugin-eventsearch-windows-x86_64.exe
osslsigncode sign -pkcs12 cert.pfx -pass $CERT_PASS -n "SFTPGo plugin eventsearch" -i "https://github.com/sftpgo/sftpgo-plugin-eventsearch" -ts "http://timestamp.sectigo.com" -h sha2 -in sftpgo-plugin-eventsearch-windows-arm64.exe -out bin/sftpgo-plugin-eventsearch-windows-arm64.exe
osslsigncode sign -pkcs12 cert.pfx -pass $CERT_PASS -n "SFTPGo plugin eventsearch" -i "https://github.com/sftpgo/sftpgo-plugin-eventsearch" -ts "http://timestamp.sectigo.com" -h sha2 -in sftpgo-plugin-eventsearch-windows-x86.exe -out bin/sftpgo-plugin-eventsearch-windows-x86.exe
rm -f cert.pfx
fi
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-linux-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-linux-armv7
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-linux-ppc64le
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-darwin-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.commitHash=`git describe --always --dirty` -X github.com/sftpgo/sftpgo-plugin-eventsearch/cmd.buildDate=`date -u +%FT%TZ`" -o bin/sftpgo-plugin-eventsearch-darwin-arm64
shell: bash
env:
CERT_DATA: ${{ secrets.CERT_DATA }}
CERT_PASS: ${{ secrets.CERT_PASS }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: sftpgo-plugin-eventsearch
path: bin
test-providers:
name: Test supported providers
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sftpgo_events
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mariadb:
image: mariadb:latest
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: sftpgo_events
MYSQL_USER: sftpgo
MYSQL_PASSWORD: sftpgo
options: >-
--health-cmd "mariadb-admin 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
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run tests using PostgreSQL provider
run: |
go test -v -p 1 -timeout 5m ./... -covermode=atomic
env:
SFTPGO_PLUGIN_EVENTSEARCH_DRIVER: postgres
SFTPGO_PLUGIN_EVENTSEARCH_DSN: "host='127.0.0.1' port=5432 dbname='sftpgo_events' user='postgres' password='postgres' sslmode=disable connect_timeout=10"
- name: Run tests using MySQL provider
run: |
go test -v -p 1 -timeout 5m ./... -covermode=atomic
env:
SFTPGO_PLUGIN_EVENTSEARCH_DRIVER: mysql
SFTPGO_PLUGIN_EVENTSEARCH_DSN: "sftpgo:sftpgo@tcp([127.0.0.1]:3307)/sftpgo_events?charset=utf8mb4&interpolateParams=true&timeout=10s&tls=false&writeTimeout=10s&readTimeout=10s&parseTime=true"
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: latest