Update cli.py #36
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: Setup PostgreSQL on macOS without Admin | |
on: [push] | |
jobs: | |
postgresql-setup: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download PostgreSQL Portable Edition | |
run: | | |
wget https://get.enterprisedb.com/postgresql/postgresql-14.1-1-osx-binaries.zip -O postgresql.zip | |
unzip postgresql.zip -d $GITHUB_WORKSPACE | |
mv $GITHUB_WORKSPACE/pgsql $GITHUB_WORKSPACE/postgresql | |
- name: Setup PostgreSQL environment variables | |
run: | | |
echo 'export POSTGRESQL_HOME=$GITHUB_WORKSPACE/postgresql' >> $GITHUB_ENV | |
echo 'export PATH=$POSTGRESQL_HOME/bin:$PATH' >> $GITHUB_ENV | |
source $GITHUB_ENV | |
- name: Source environment variables | |
run: | | |
ls | |
echo $GITHUB_WORKSPACE | |
ls $GITHUB_WORKSPACE | |
source $GITHUB_ENV | |
- name: Initialize PostgreSQL data directory | |
run: | | |
$GITHUB_WORKSPACE/postgresql/bin/initdb -D $GITHUB_WORKSPACE/postgresql_data | |
- name: Start PostgreSQL server | |
run: $GITHUB_WORKSPACE/postgresql/bin/pg_ctl -D $GITHUB_WORKSPACE/postgresql_data -l logfile start | |
- name: Wait for PostgreSQL to start | |
run: | | |
for i in {30..0}; do | |
if $GITHUB_WORKSPACE/postgresql/bin/pg_isready &>/dev/null; then | |
break | |
fi | |
echo 'Waiting for PostgreSQL to start...' | |
sleep 1 | |
done | |
- name: Set up PostgreSQL user and database | |
run: | | |
$GITHUB_WORKSPACE/postgresql/bin/createdb "runner" | |
$GITHUB_WORKSPACE/postgresql/bin/psql -c "CREATE USER msnoise WITH PASSWORD 'msnoise';" | |
$GITHUB_WORKSPACE/postgresql/bin/psql -c "ALTER USER msnoise WITH SUPERUSER;" | |
- name: Verify PostgreSQL setup | |
run: $GITHUB_WORKSPACE/postgresql/bin/psql -c "\l" |