Skip to content

Commit

Permalink
chore: Move CI from circleci to GitHub Actions #6
Browse files Browse the repository at this point in the history
  • Loading branch information
erayhanoglu committed Sep 14, 2024
1 parent dbe687e commit af38576
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v4
- run: date
- run: |
date
sudo apt purge postgresql-14
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install "postgresql-${{ matrix.postgres }}"
- run: |
sudo cp ./test/_support/pg_hba.conf /etc/postgresql/${{ matrix.postgres }}/main/pg_hba.conf
sudo cat /etc/postgresql/${{ matrix.postgres }}/main/pg_hba.conf
- run: |
sudo sed -i 's/.*wal_level.*/wal_level = logical/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*max_prepared_transactions.*/max_prepared_transactions = 100/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*ssl = .*/ssl = on/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
Expand All @@ -43,6 +46,7 @@ jobs:
sudo chmod og-rwx /etc/postgresql/${{ matrix.postgres }}/main/server.key
sudo systemctl start postgresql.service
sudo systemctl status postgresql.service
- run: |
pg_isready
sudo -u postgres psql -c "SHOW hba_file;"
# - uses: denoland/setup-deno@v1
Expand All @@ -55,7 +59,7 @@ jobs:
- run: npm install
- run: npm run lint
- run: npm run check
- run: npm test
- run: npm run citest
env:
NODE_TLS_REJECT_UNAUTHORIZED: 0
PGUSER: postgres
Expand Down
4 changes: 2 additions & 2 deletions test/_support/create-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ const dataFiles: any[] = [

export async function createTestSchema() {
const client = new Client({
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
user: process.env.PGUSER || 'postgres',
password: process.env.PGPASSWORD || 'postgres',
host: process.env.PGHOST,
port: process.env.PGPORT ? parseInt(process.env.PGPORT, 10) : 5432,
database: process.env.PGDATABASE,
Expand Down
2 changes: 1 addition & 1 deletion test/_support/init-pg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function configurePostgresql() {
const database = process.env.PGDATABASE || 'postgrejs_test';
const user = database;
const user_md5 = process.env.LOGIN_MD5 || 'postgrejs_test_md5';
const user_scram = process.env.LOGIN_MD5 || 'postgrejs_test_scram';
const user_scram = process.env.LOGIN_SCRAM || 'postgrejs_test_scram';
exec('dropdb', [database]);

exec('psql', ['-c', 'alter system set ssl=on']);
Expand Down

0 comments on commit af38576

Please sign in to comment.