forked from Harmon758/postgresql-action
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SoftwareparkVeroo/master
Add parameter for optional DB init scripts.
- Loading branch information
Showing
8 changed files
with
201 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: ./ | ||
with: | ||
postgresql password: test | ||
postgresql init scripts: test/sql | ||
|
||
- uses: actions/setup-node@v1 | ||
|
||
- run: npm ci | ||
working-directory: test | ||
|
||
- run: node index.js | ||
working-directory: test |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { Client } = require('pg') | ||
|
||
async function run() { | ||
const client = new Client({ | ||
host: 'localhost', | ||
user: 'postgres', | ||
database: 'postgres', | ||
password: 'test', | ||
port: 5432 | ||
}) | ||
await client.connect() | ||
const res = await client.query('SELECT * FROM Persons') | ||
const data = res.rows[0] | ||
if (data.personid != 1) { | ||
throw new Error("Unexpected PersonId") | ||
} | ||
await client.end() | ||
} | ||
|
||
async function sleep(ms) { | ||
return new Promise(resolve => { | ||
setTimeout(resolve, ms) | ||
}) | ||
} | ||
|
||
run().catch((err) => { | ||
console.error(err) | ||
process.exit(1) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "test", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"pg": "^7.13.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE Persons ( | ||
PersonID int, | ||
LastName varchar(255), | ||
FirstName varchar(255), | ||
Address varchar(255), | ||
City varchar(255) | ||
); | ||
|
||
INSERT INTO Persons VALUES (1, 'Last', 'First', 'TestAddress', 'TestCity'); |