mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-28 09:36:56 +00:00
Create scripts for testing locally
This commit is contained in:
parent
dd90724c54
commit
05f012aecd
3 changed files with 113 additions and 0 deletions
49
compose.local-test.yml
Normal file
49
compose.local-test.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
# このconfigは、 dockerでMisskey本体を起動せず、 redisとpostgresql などだけを起動します
|
||||
|
||||
services:
|
||||
redis:
|
||||
restart: always
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis:/data
|
||||
healthcheck:
|
||||
test: "redis-cli ping"
|
||||
interval: 5s
|
||||
retries: 20
|
||||
|
||||
postgres:
|
||||
restart: always
|
||||
image: postgres:15-alpine
|
||||
ports:
|
||||
- "5432:5432"
|
||||
env_file:
|
||||
- .config/docker.env
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
|
||||
interval: 5s
|
||||
retries: 20
|
||||
|
||||
web:
|
||||
restart: always
|
||||
image: node:iron
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ./:/host
|
||||
command: sleep infinity
|
||||
|
||||
# meilisearch:
|
||||
# restart: always
|
||||
# image: getmeili/meilisearch:v1.3.4
|
||||
# environment:
|
||||
# - MEILI_NO_ANALYTICS=true
|
||||
# - MEILI_ENV=production
|
||||
# env_file:
|
||||
# - .config/meilisearch.env
|
||||
# volumes:
|
||||
# - ./meili_data:/meili_data
|
||||
|
42
setup-tests.sh
Executable file
42
setup-tests.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "This script will destroy the following local directories:"
|
||||
echo " ./built"
|
||||
echo " ./db"
|
||||
echo " ./redis"
|
||||
echo
|
||||
echo "Do you want to continue? [Y/n]"
|
||||
read -p "> " confirmation
|
||||
|
||||
case $confirmation in
|
||||
[Yy]* )
|
||||
echo "Continuing..."
|
||||
;;
|
||||
[Nn] )
|
||||
echo "Exiting..."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
cp compose.local-test.yml compose.yml
|
||||
|
||||
echo Verifying containers are down...
|
||||
docker compose down
|
||||
docker compose rm
|
||||
|
||||
echo Removing any preexisting builds and databases.
|
||||
echo This may take a few moments...
|
||||
rm -rf ./built ./db ./redis
|
||||
|
||||
echo Creating environment
|
||||
docker compose up -d
|
||||
docker compose exec web apt-get update
|
||||
docker compose exec web apt-get install -y bash
|
||||
|
||||
echo Building and running tests...
|
||||
docker compose exec web /host/tests.sh
|
||||
|
||||
echo Cleaning up...
|
||||
docker compose down
|
||||
docker compose rm
|
||||
rm -f compose.yml
|
22
tests.sh
Executable file
22
tests.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# Do not run this on your local machine. Instead, execute setup-tests.sh and it
|
||||
# will automatically create, test, and tear down the testing environment.
|
||||
|
||||
set -e
|
||||
|
||||
cd /host/
|
||||
echo Removing any preexisting builds and databases.
|
||||
echo This may take a few moments...
|
||||
rm -rf ./built ./db ./redis
|
||||
apt-get update && apt-get install -y git wget curl build-essential python3 ffmpeg
|
||||
cp .config/ci.yml .config/default.yml
|
||||
cp .config/ci.yml .config/test.yml
|
||||
corepack enable
|
||||
corepack prepare pnpm@latest --activate
|
||||
git submodule update --init
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
pnpm run migrate
|
||||
pnpm run --filter='!megalodon' test
|
||||
pnpm run --filter=backend --filter=misskey-js lint
|
||||
pnpm run --filter=frontend --filter=frontend-embed eslint
|
Loading…
Add table
Reference in a new issue