feat: create user awareness table #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Migration Tests and Benchmarks | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- postgres/migrations/** | |
- postgres/benches/** | |
pull_request: | |
branches: | |
- main | |
paths: | |
- postgres/migrations/** | |
- postgres/benches/** | |
env: | |
PGHOST: localhost | |
PGPORT: 5432 | |
PGUSER: postgres | |
PGPASSWORD: password | |
PGDB: postgres | |
jobs: | |
migrations: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Packages | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install postgresql-client | |
- name: Start postgres | |
working-directory: ./postgres/migrations | |
run: | | |
docker build -t appflowy_postgres . | |
docker run -e POSTGRES_PASSWORD=password -p 5432:5432 -d appflowy_postgres | |
sleep 10 # wait for ready | |
- name: Run all up migrations | |
working-directory: ./postgres/migrations | |
run: | | |
for sql_script in $(ls | grep _up.sql | sort) | |
do | |
echo "Executing $sql_script" | |
psql --host=$PGHOST --username=$PGUSER --dbname=$PGDB --file=$sql_script --variable ON_ERROR_STOP=on | |
if [ $? -ne 0 ] | |
then | |
echo "Migration $sql_script failed" | |
exit 1 | |
fi | |
done | |
- name: Run migration tests | |
working-directory: ./postgres/migrations_tests | |
run: | | |
./check | |
./af_user | |
./af_collab_update | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
AppFlowy-Supabase/postgres | |
cache-all-crates: true | |
- name: Run benchmark (insert into af_collab_update) | |
working-directory: ./postgres | |
run: cargo bench | |
- name: Run all down migrations | |
working-directory: ./postgres/migrations | |
run: | | |
for sql_script in $(ls | grep .down.sql | sort -r) | |
do | |
echo "Executing $sql_script" | |
psql --host=$PGHOST --username=$PGUSER --dbname=$PGDB --file=$sql_script --variable ON_ERROR_STOP=on | |
if [ $? -ne 0 ] | |
then | |
echo "Migration $sql_script failed" | |
exit 1 | |
fi | |
done | |
# should not have any relations after down | |
ITEMS=$(psql --host=$PGHOST --username=$PGUSER --dbname=$PGDB --command "\d") | |
if [[ "$ITEMS" ]]; then | |
echo "There are still items after executing all down scripts" | |
exit 1 | |
fi |