Skip to content

Prevent event listeners from missing the first POST_EVENT. #161

Prevent event listeners from missing the first POST_EVENT.

Prevent event listeners from missing the first POST_EVENT. #161

Workflow file for this run

name: Go
permissions:
contents: read
code-quality: write
on:
push:
pull_request:
jobs:
fmt:
runs-on: self-hosted
container:
image: golang:1.26
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Run go fmt and go vet
run: |
go fmt $(go list ./... | grep -v /vendor/)
go vet $(go list ./... | grep -v /vendor/)
lint:
runs-on: self-hosted
container:
image: golangci/golangci-lint:v2.15.0
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Run golangci-lint
run: |
golangci-lint run --output.code-climate.path codeclimate-report.json --output.text.path stdout
test:
runs-on: self-hosted
container:
image: golang:${{ matrix.GO_VERSION || '1.26' }}
strategy:
matrix:
include:
- FB_VERSION: "3.0.14.33856-0"
KIND: "fb"
- FB_VERSION: "4.0.7.3271-0"
KIND: "fb"
- FB_VERSION: "5.0.4.1812-0"
KIND: "fb"
- FB_VERSION: "5.0.4.1812-0"
KIND: "fb"
GO_VERSION: "1.27"
REPORT_SUFFIX: _go1.27
- RDB_VERSION: "3.0.24"
RDB_PROJECT: "rdb30"
- RDB_VERSION: "5.1.6"
RDB_PROJECT: "rdb50"
- RDB_VERSION: "5.2.5"
RDB_PROJECT: "rdb50"
- RDB_VERSION: "5.3.1"
RDB_PROJECT: "rdb50"
- RDB_VERSION: "6.0.0-SNAPSHOT.1623"
RDB_PROJECT: "rdb60"
env:
FB_DOWNLOAD_URL: http://minio.red-soft.biz/3rdparty/firebird/Firebird-${{matrix.FB_VERSION}}-linux-x64.tar.gz
RDB_DOWNLOAD_URL: http://builds.red-soft.biz/release_hub/${{matrix.RDB_PROJECT}}/${{matrix.RDB_VERSION}}/download/red-database:linux-x86_64-enterprise:${{matrix.RDB_VERSION}}:bin
REPORT: ${{matrix.KIND || 'rdb'}}_${{matrix.FB_VERSION}}${{matrix.RDB_VERSION}}${{matrix.REPORT_SUFFIX}}
FBX_TEST_DATABASE: database=employee host=localhost port=3050 user=sysdba password=masterkey
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install and configure server
shell: bash
run: |
set -e
if [ "${{matrix.KIND || 'rdb'}}" = "rdb" ]; then
echo Download RDB
wget -q $RDB_DOWNLOAD_URL -O installer
chmod +x ./installer
echo Install RDB
./installer --mode unattended --sysdba_password masterkey
echo Configure RDB
cp ci/firebird.conf ci/fbtrace.conf /opt/RedDatabase
g++ -o libfbxci.so -shared -fPIC ci/udrs.cpp -I_tools/msgs/include
cp libfbxci.so /opt/RedDatabase/plugins/udr
echo Start RDB
if [ -e /etc/init.d/reddatabase ]; then
/etc/init.d/reddatabase start
else
/etc/init.d/firebird start
fi
else
echo Install dependencies
apt update && apt install -y libtommath1 libicu76
ln -s /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0
ln -s /usr/lib/x86_64-linux-gnu/libncursesw.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
echo Download FB
wget -q $FB_DOWNLOAD_URL -O fb.tar.gz
tar xf fb.tar.gz
pushd Firebird-${FB_VERSION}*
echo Install FB
./install.sh -silent
popd
echo Configure FB
. /opt/firebird/SYSDBA.password
export ISC_PASSWORD
echo "alter user sysdba set password 'masterkey';" | /opt/firebird/bin/isql -u sysdba localhost:employee
cp ci/firebird.conf /opt/firebird
g++ -o /opt/firebird/plugins/udr/libfbxci.so -shared -fPIC ci/udrs.cpp -I_tools/msgs/include
echo Start FB
runuser -u firebird -- start-stop-daemon --stop --oknodo \
--retry TERM/35/KILL/5 --exec /opt/firebird/bin/fbguard
runuser -u firebird -- start-stop-daemon --stop --oknodo \
--retry TERM/10/KILL/5 --exec /opt/firebird/bin/firebird
/etc/init.d/firebird start
fi
- name: Run test
run: |
COVERDIR=$(pwd)/reports/${REPORT}
PACKAGES=$(go list ./... 2> /dev/null | grep -v /vendor/|xargs|tr ' ' ",")
mkdir -p ${COVERDIR}
go run gotest.tools/gotestsum@v1.13.0 --format testname -- -p 1 ${GOTEST_EXTRA_ARGS} -cover ./... -coverpkg=${PACKAGES} -test.gocoverdir=${COVERDIR}
- uses: actions/upload-artifact@v7
with:
name: coverage-${{matrix.KIND || 'rdb'}}_${{matrix.FB_VERSION}}${{matrix.RDB_VERSION}}${{matrix.REPORT_SUFFIX}}
path: ./reports
coverage:
runs-on: self-hosted
container:
image: golang:1.27
needs: test
steps:
- name: Install dependencies
shell: bash
run: |
apt update && apt install -y gh
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/download-artifact@v8
with:
path: ./reports
pattern: coverage-*
merge-multiple: true
- name: Generate coverage report
shell: bash
run: |
set -e
mkdir merged
REPORTS=$(find reports/* -maxdepth 0|xargs|sed 's/ /,/g')
go tool covdata merge -i=${REPORTS} -o merged
go tool covdata textfmt -i=merged -o coverage.txt
go run github.com/boumenot/gocover-cobertura@v1.5.0 < coverage.txt > coverage.xml
- name: Upload coverage report
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-code-coverage@v1
with:
file: coverage.xml
language: Go
label: code-coverage/gotest