Skip to content

Commit dc93b03

Browse files
committed
ci: add sqlite
1 parent b6cdc4a commit dc93b03

File tree

2 files changed

+78
-2
lines changed

2 files changed

+78
-2
lines changed

.github/workflows/dev.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,71 @@ jobs:
560560
task dredd:hooks
561561
task dredd:test
562562
563+
integrate-sqlite:
564+
runs-on: ubuntu-latest
565+
566+
needs:
567+
- migrate-sqlite
568+
569+
steps:
570+
- name: Checkout source
571+
uses: actions/checkout@v4
572+
573+
- name: Setup golang
574+
uses: actions/setup-go@v5
575+
with:
576+
go-version: '^1.21.0'
577+
578+
- name: Setup nodejs
579+
uses: actions/setup-node@v4
580+
with:
581+
node-version: '16'
582+
cache: 'npm'
583+
cache-dependency-path: web/package-lock.json
584+
585+
- name: Install go-task
586+
run: |
587+
go install github.com/go-task/task/v3/cmd/task@latest
588+
589+
- name: Download artifacts
590+
uses: actions/download-artifact@v4
591+
with:
592+
name: semaphore
593+
594+
- name: Write config
595+
run: |
596+
cat > config.stdin <<EOF
597+
4
598+
localhost:5432
599+
semaphore
600+
p455w0rd
601+
semaphore
602+
/tmp/semaphore
603+
http://localhost:3000
604+
no
605+
no
606+
no
607+
no
608+
no
609+
no
610+
$(pwd)/.dredd
611+
admin
612+
admin@localhost
613+
Developer
614+
password
615+
EOF
616+
617+
- name: Execute setup
618+
run: |
619+
chmod +x ./semaphore && ./semaphore setup - < config.stdin
620+
621+
- name: Launch dredd
622+
run: |
623+
task dredd:goodman
624+
task dredd:deps
625+
task dredd:hooks
626+
task dredd:test
627+
563628
deploy-server:
564629
runs-on: ubuntu-latest
565630
if: github.repository_owner == 'semaphoreui'

deployment/docker/server/server-wrapper

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ if [ -z "${SEMAPHORE_DB_HOST}" ]; then
8686
fi
8787

8888
if [ -z "${SEMAPHORE_DB_HOST}" ]; then
89-
if [ "${SEMAPHORE_DB_DIALECT}" == 'bolt' ]; then
89+
if [ "${SEMAPHORE_DB_DIALECT}" = 'bolt' ]; then
9090
export SEMAPHORE_DB_HOST=${SEMAPHORE_DB_PATH}/database.boltdb
91+
elif [ "${SEMAPHORE_DB_DIALECT}" = 'sqlite' ]; then
92+
export SEMAPHORE_DB_HOST=${SEMAPHORE_DB_PATH}/database.sqlite
9193
else
9294
export SEMAPHORE_DB_HOST="${SEMAPHORE_DB_HOST:-0.0.0.0}"
9395
fi
@@ -119,6 +121,8 @@ if [ -z "${SEMAPHORE_DB_PORT}" ]; then
119121
;;
120122
bolt)
121123
;;
124+
sqlite)
125+
;;
122126
*)
123127
echoerr "Unknown database dialect: ${SEMAPHORE_DB_DIALECT}"
124128
exit 1
@@ -130,7 +134,7 @@ fi
130134
#
131135
# Ping database if it is not BoltDB
132136
#
133-
if [ "${SEMAPHORE_DB_DIALECT}" != 'bolt' ]; then
137+
if [ "${SEMAPHORE_DB_DIALECT}" != 'bolt' ] && [ "${SEMAPHORE_DB_DIALECT}" != 'sqlite' ]; then
134138
echoerr "Pinging database on ${SEMAPHORE_DB_HOST} port ${SEMAPHORE_DB_PORT}..."
135139
TIMEOUT=30
136140

@@ -177,6 +181,9 @@ if [ ! -f "${SEMAPHORE_CONFIG_PATH}/config.json" ]; then
177181
postgres)
178182
SEMAPHORE_DB_DIALECT_ID=3
179183
;;
184+
sqlite)
185+
SEMAPHORE_DB_DIALECT_ID=4
186+
;;
180187
*)
181188
echoerr "Unknown database dialect: ${SEMAPHORE_DB_DIALECT}"
182189
exit 1
@@ -191,6 +198,10 @@ EOF
191198
if [ "${SEMAPHORE_DB_DIALECT}" = "bolt" ]; then
192199
cat << EOF >> "${TMP_STDIN_CONFIG_FILE}"
193200
${SEMAPHORE_DB_HOST}
201+
EOF
202+
elif [ "${SEMAPHORE_DB_DIALECT}" = "sqlite" ]; then
203+
cat << EOF >> "${TMP_STDIN_CONFIG_FILE}"
204+
${SEMAPHORE_DB_HOST}
194205
EOF
195206
else
196207
cat << EOF >> "${TMP_STDIN_CONFIG_FILE}"

0 commit comments

Comments
 (0)