Skip to content

Commit

Permalink
Reenables test on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ghivert authored and lpil committed May 20, 2024
1 parent 90594c9 commit ffd052b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,33 @@ on:
jobs:
test:
runs-on: ubuntu-latest
# container: ubuntu:20.04
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "25.1"
gleam-version: "0.34.0"
gleam-version: "1.1.0"
rebar3-version: "3"
# ImageOS: ubuntu20
- run: gleam build
# TODO: enable testing again
# - run: gleam test
- run: ./test/reset_db.sh
env:
PGHOST: localhost
PGPORT: 5432
PGPASSWORD: postgres
PGUSER: postgres
- run: gleam test
- run: gleam format --check src test
7 changes: 6 additions & 1 deletion test/gleam/pgo_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ pub fn url_config_path_slash_test() {
}

fn start_default() {
pgo.Config(..pgo.default_config(), database: "gleam_pgo_test", pool_size: 1)
pgo.Config(
..pgo.default_config(),
database: "gleam_pgo_test",
password: Some("postgres"),
pool_size: 1,
)
|> pgo.connect
}

Expand Down
4 changes: 2 additions & 2 deletions test/reset_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ set -eu
echo
echo Resetting database

psql -h localhost -U postgres <<SQL
psql <<SQL
SELECT 'CREATE DATABASE gleam_pgo_test'
WHERE NOT EXISTS (
SELECT FROM pg_database WHERE datname = 'gleam_pgo_test'
)\\gexec
SQL

psql -v "ON_ERROR_STOP=1" -h localhost -U postgres -d gleam_pgo_test <<SQL
psql -v "ON_ERROR_STOP=1" -d gleam_pgo_test <<SQL
DROP TABLE IF EXISTS cats;
CREATE TABLE cats (
id SERIAL PRIMARY KEY,
Expand Down

0 comments on commit ffd052b

Please sign in to comment.