Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CI #41

Merged
merged 7 commits into from
Feb 7, 2021
Merged

Adding CI #41

merged 7 commits into from
Feb 7, 2021

Conversation

hjmtql
Copy link
Contributor

@hjmtql hjmtql commented Feb 5, 2021

It will be easier to maintain and contribute to this awesome library.

"test:guide:custom": "npm run-script lit && spago test --main Test.Guide.Custom",
"test:guide": "npm-run-all --sequential test:guide:*",
"test:main": "spago test",
"test": "npm-run-all --sequential test:*"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate tests that use pg backend because they may cause conflicts related to transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often got error when running test before

| Error: (IntegrityError { code: "23505", column: "", constraint: "pg_type_typname_nsp_index", dataType: "", detail: "Key (typname, typnamespace)=(people, 2200) already exists.", file: "nbtinsert.c", hint: "", internalPosition: "", internalQuery: "", line: "570", message: "duplicate key value violates unique constraint \"pg_type_typname_nsp_index\"", position: "", routine: "_bt_check_unique", schema: "pg_catalog", severity: "ERROR", table: "pg_type", where_: "" })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a transaction overlapping when the error occured.

↓ postgres logs

db_1  | 2021-02-05 05:30:01.581 UTC [81] LOG:  connection received: host=192.168.176.1 port=44946
db_1  | 2021-02-05 05:30:01.581 UTC [82] LOG:  connection received: host=192.168.176.1 port=44948
db_1  | 2021-02-05 05:30:01.581 UTC [83] LOG:  connection received: host=192.168.176.1 port=44950
db_1  | 2021-02-05 05:30:01.585 UTC [82] LOG:  connection authorized: user=init database=purspg
db_1  | 2021-02-05 05:30:01.585 UTC [81] LOG:  connection authorized: user=init database=purspg
db_1  | 2021-02-05 05:30:01.586 UTC [83] LOG:  connection authorized: user=init database=purspg
db_1  | 2021-02-05 05:30:01.589 UTC [81] LOG:  statement: BEGIN TRANSACTION
db_1  | 2021-02-05 05:30:01.590 UTC [81] LOG:  statement: 
db_1  | 	  DROP TABLE IF EXISTS people;
db_1  | 	  CREATE TABLE people (
db_1  | 	    id INTEGER PRIMARY KEY,
db_1  | 	    name TEXT NOT NULL,
db_1  | 	    age INTEGER
db_1  | 	  );
db_1  | 2021-02-05 05:30:01.592 UTC [82] LOG:  statement: BEGIN TRANSACTION
db_1  | 2021-02-05 05:30:01.592 UTC [83] LOG:  statement: 
db_1  | 	        DROP TABLE IF EXISTS people;
db_1  | 	        CREATE TABLE people (
db_1  | 	          id INTEGER PRIMARY KEY,
db_1  | 	          name TEXT NOT NULL,
db_1  | 	          age INTEGER
db_1  | 	        );
db_1  | 	
db_1  | 	        DO $$
db_1  | 	        BEGIN
db_1  | 	          IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'account_type') THEN
db_1  | 	            CREATE TYPE ACCOUNT_TYPE as ENUM (
db_1  | 	              'business',
db_1  | 	              'personal'
db_1  | 	            );
db_1  | 	          END IF;
db_1  | 	        END$$;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might have been best if it could be split in the code, but it was difficult so I split them using npm-run-all.
@Kamirus How do you think the solution is good?

},
"author": "",
"license": "ISC",
"dependencies": {
"decimal.js": "^10.0.1",
"pg": "^7.6.0",
"pg": "^8.5.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix #39

@Kamirus
Copy link
Owner

Kamirus commented Feb 5, 2021

Thank you for your effort! CI is very much welcome indeed.
Errors you've encountered are probably caused by some parallel execution - do they still occur? Or separating guides from other tests helped?

Also maybe @paluh might know more.

@hjmtql
Copy link
Contributor Author

hjmtql commented Feb 5, 2021

@Kamirus

Thank you for your quick reply!

Or separating guides from other tests helped?

-> Yes it does.
npm-run-all --sequential runs in sequence, so it doesn't seem to cause parallel execution problems.

I have never faced any error at the moment (on my local and github actions) since I separated PG tests.
test-branch: https://github.com/hjmtql/purescript-selda/runs/1839387218

@Kamirus
Copy link
Owner

Kamirus commented Feb 5, 2021

Cool thank you very much!
@paluh do you think we should add anything or this is ready to merge?

@paluh
Copy link
Collaborator

paluh commented Feb 5, 2021

Thanks a lot @hjmtql for this contribution! This is really cool. For a long time we weren't even sure whether it is possible to setup such a CI :-)
When purescript-cookbook finishes migration to github actions we are probably nearly ready to go!

@paluh do you think we should add anything or this is ready to merge?

I think we can merge this.
I'm not sure if we want to rebase it on the devel branch (with force push) and fix possible problems there before the final merge to master or we are going to merge devel later and fix all problems on the master. Either way should work for our small team :-P
But speaking a bit more seriously we should probably think about reliable and official branching flow for the project ;-)

@hjmtql
Copy link
Contributor Author

hjmtql commented Feb 6, 2021

I used docker-compose newly, so I added short notes to README.md

@Kamirus
Copy link
Owner

Kamirus commented Feb 6, 2021

Great! @hjmtql would you like to add anything else or do you think it's ready to merge?

@hjmtql
Copy link
Contributor Author

hjmtql commented Feb 7, 2021 via email

@Kamirus Kamirus merged commit d61b508 into Kamirus:master Feb 7, 2021
@hjmtql hjmtql deleted the ci branch February 7, 2021 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants