Skip to content

Commit

Permalink
revert to core process
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Jan 29, 2024
1 parent c61e99e commit 9f706c1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
23 changes: 4 additions & 19 deletions .github/actions/setup-postgres-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,7 @@ runs:

- name: Start the postgres service
shell: bash
run: sudo systemctl start postgresql.service

- name: Grant access to the directory
shell: bash
run: sudo chown -R 777 ./scripts

- name: Grant access to the file
shell: bash
run: sudo chown -R postgres:postgres setup_test_database.sql
working-directory: ./scripts

- name: Configure the database
shell: bash
run: sudo -u postgres psql -f ./setup_test_database.sql
working-directory: ./scripts

# - name: Configure the database
# shell: bash
# run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh
run: |
sudo systemctl start postgresql.service
pg_isready
sudo -u postgres bash ${{ github.action_path }}/setup_db.sh
19 changes: 19 additions & 0 deletions .github/actions/setup-postgres-linux/setup_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,29 @@ PGPORT="${PGPORT:-5432}"
export PGPORT
PGHOST="${PGHOST:-localhost}"

function connect_circle() {
# try to handle circleci/docker oddness
let rc=1
while [[ $rc -eq 1 ]]; do
nc -z ${PGHOST} ${PGPORT}
let rc=$?
done
if [[ $rc -ne 0 ]]; then
echo "Fatal: Could not connect to $PGHOST"
exit 1
fi
}

# appveyor doesn't have 'nc', but it also doesn't have these issues
if [[ -n $CIRCLECI ]]; then
connect_circle
fi

for i in {1..10}; do
if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then
break
fi

echo "Waiting for postgres to be ready..."
sleep 2;
done;
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Setup `hatch`
uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup postgres
uses: ./.github/actions/setup-postgres-linux

- name: Setup `hatch`
uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release
with:
python-version: ${{ matrix.python-version }}

- name: Run integration tests
run: hatch run integration-tests:all

Expand Down

0 comments on commit 9f706c1

Please sign in to comment.