feat: CI: test w postgres service
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Aravinth Manivannan 2024-05-06 11:03:48 +05:30
parent 44512bc616
commit f4ef3f501d
Signed by: realaravinth
GPG Key ID: F8F50389936984FF
2 changed files with 41 additions and 46 deletions

View File

@ -6,12 +6,11 @@ steps:
environment:
- DATABASE_URL=postgres://postgres:password@database:5432/postgres
commands:
- curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
- apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
# - curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
# - apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
- rustup component add rustfmt
- rustup component add clippy
# - make dev-env
# - make migrate
- make db.migrate
- make lint
- make test
- make release
@ -59,45 +58,8 @@ steps:
# - scripts/bin-publish.sh publish master latest $DUMBSERVE_PASSWORD
# secrets: [RELEASE_BOT_GPG_SIGNING_KEY, DUMBSERVE_PASSWORD, GPG_PASSWORD]
#
#services:
# database:
# image: postgres
# environment:
# - POSTGRES_PASSWORD=password
#
# forms-postgres:
# image: postgres
# environment:
# - POSTGRES_PASSWORD=password
#
# librepages-forms:
# image: forgeflux/forgeflux-forms
# command: forms serve
# environment:
# - LPFORMS_SOURCE_CODE=https://git.batsense.net/LibrePages/forms
# - LPFORMS_SERVER__PROXY_HAS_TLS=false
# - LPFORMS_DEBUG=false
# - LPFORMS_SERVER_URL_PREFIX=""
# - LPFORMS_SERVER_DOMAIN=forms.librepages.test
# - LPFORMS_SERVER_IP=0.0.0.0
# - LPFORMS_SERVER_PROXY_HAS_TLS=false
# - LPFORMS_DASH_API_KEY=longrandomlygeneratedpassword
# - LPFORMS_DATABASE_POOL=2
# - PORT=6000
# - DATABASE_URL=postgres://postgres:password@forms-postgres:5432/postgres
#
# librepages-conductor:
# image: forgeflux/forgeflux-conductor
# command: conductor serve
# environment:
# - LPCONDUCTOR_SERVER__PROXY_HAS_TLS=false
# - LPCONDUCTOR_DEBUG=false
# - LPCONDUCTOR_CONDUCTOR=dummy
# - LPCONDUCTOR_SERVER_URL_PREFIX=""
# - LPCONDUCTOR_SERVER_DOMAIN=librepages.test
# - LPCONDUCTOR_SERVER_IP=0.0.0.0
# - LPCONDUCTOR_SERVER_PROXY_HAS_TLS=false
# - LPCONDUCTOR_SERVER_PORT=7000
# - LPCONDUCTOR_SOURCE_CODE=https://example.org
# - LPCONDUCTOR_CREDS_TOKEN=longrandomlygeneratedpassword
# - PORT=5000
services:
database:
image: postgres
environment:
- POSTGRES_PASSWORD=password

View File

@ -1,3 +1,17 @@
define deploy_dependencies ## deploy dependencies
@-docker create --name ${db} \
-e POSTGRES_PASSWORD=password \
-p 5432:5432 \
postgres
docker start ${db}
endef
define run_migrations ## run database migrations
cd utils/db-migrations/ && unset DATABASE_URL && cargo build
cd utils/db-migrations/ && cargo run
endef
#define cache_bust ## run cache_busting program
# npm run sass
# cd utils/cache-bust && cargo run
@ -17,6 +31,13 @@ check: ## Check for syntax errors on all workspaces
clean: ## Clean all build artifacts and dependencies
@cargo clean
db.migrate: ## run migrations
$(call run_migrations)
db.sqlx.offline: ## prepare sqlx offline data
cargo sqlx prepare \
--database-url=${DATABASE_URL} -- \
--all-features
#dev-env: ## Download development dependencies
# npm install
@ -36,6 +57,18 @@ docker.publish: docker.build ## Build and publish docker images
docker push forgeflux/forgeflux:latest
docker push forgeflux/forgeflux:0.1.0
env.db: ## Deploy dependencies
$(call deploy_dependencies)
sleep 5
$(call run_migrations)
env.db.recreate: ## Deploy dependencies from scratch
@-docker rm -f ${db}
$(call deploy_dependencies)
sleep 5
$(call run_migrations)
lint: ## Lint codebase
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features