From 7a09e1b860af2833f16e8375c88d503d43cfb26d Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Fri, 8 Sep 2023 22:51:16 +0800 Subject: [PATCH] chore: remove redundant sqlx command (#22) * chore: remove redundant sqlx command * chore: remove docker_env.sh * chore: copy sqlx to docker * chore update --- .github/workflows/docker.yml | 2 -- .github/workflows/rustlint.yml | 4 +--- Makefile | 13 +------------ build/docker_env.sh | 10 ---------- build/run_local_server.sh | 2 -- dev.env | 2 +- 6 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 build/docker_env.sh diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a1d69cb3..783e739e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -61,6 +61,4 @@ jobs: - name: Run tests run: | cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked - cargo sqlx database create - cargo sqlx migrate run cargo test diff --git a/.github/workflows/rustlint.yml b/.github/workflows/rustlint.yml index b59931ce..63f1fb6e 100644 --- a/.github/workflows/rustlint.yml +++ b/.github/workflows/rustlint.yml @@ -33,8 +33,6 @@ jobs: - name: Install Development Dependencies run: | cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked - cargo sqlx database create - cargo sqlx migrate run - name: Check sqlx-data.json run: | @@ -44,4 +42,4 @@ jobs: run: cargo fmt --check - name: Clippy - run: SQLX_OFFLINE=true cargo clippy -- -D warnings + run: SQLX_OFFLINE=true cargo clippy -- -D warnings \ No newline at end of file diff --git a/Makefile b/Makefile index 6903b144..fbf5c8f5 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,7 @@ ROOT = "./build" SEMVER_VERSION=$(shell grep version Cargo.toml | awk -F"\"" '{print $$2}' | head -n 1) -.PHONY: prerequisite local_test - -prerequisite: - POSTGRES_PORT=5432 ${ROOT}/init_database.sh - ${ROOT}/init_redis.sh - -appflowy_cloud_image: - source $(ROOT)/docker_env.sh && docker-compose up -d appflowy_cloud - -local_test: - # 🔥 Must run init_database first - SQLX_OFFLINE=true cargo test +.PHONY: run test run: ${ROOT}/run_local_server.sh diff --git a/build/docker_env.sh b/build/docker_env.sh deleted file mode 100644 index c9ef848b..00000000 --- a/build/docker_env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -export BACKEND_VERSION="v0.0.1" - -export POSTGRES_USER=postgres -export POSTGRES_PASSWORD=password -export POSTGRES_PORT=5432 -export POSTGRES_HOST=postgres -export POSTGRES_DB=appflowy - -export DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} \ No newline at end of file diff --git a/build/run_local_server.sh b/build/run_local_server.sh index af1f8407..986496f0 100755 --- a/build/run_local_server.sh +++ b/build/run_local_server.sh @@ -16,6 +16,4 @@ until PGPASSWORD="${DB_PASSWORD}" psql -h "${DB_HOST}" -U "${DB_USER}" -p "${DB_ >&2 echo "Postgres is still unavailable - sleeping" sleep 1 done -sqlx database create -sqlx migrate run cargo run diff --git a/dev.env b/dev.env index 53eb9f71..4f6dd7a8 100644 --- a/dev.env +++ b/dev.env @@ -23,4 +23,4 @@ GOTRUE_REGISTERED_EMAIL=your_email@some_company.com GOTRUE_REGISTERED_PASSWORD=your_password # url to the postgres database -DATABASE_URL=postgres://postgres:password@localhost:5433/appflowy +DATABASE_URL=postgres://postgres:password@localhost:5433/postgres