-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.86 KB
/
test_macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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"