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

Integrate with Github CI #1413

Merged
merged 5 commits into from
Nov 24, 2023
Merged

Integrate with Github CI #1413

merged 5 commits into from
Nov 24, 2023

Conversation

almet
Copy link
Member

@almet almet commented Nov 18, 2023

  • Create Github Actions to run the tests
  • Make github actions use postgres
  • Make Playwright work
  • Support for python 3.12
  • Format the files
  • Make the linter happy

@almet almet force-pushed the almet/ci branch 20 times, most recently from 83603fc to 7f11066 Compare November 22, 2023 17:32
@almet
Copy link
Member Author

almet commented Nov 22, 2023

I don't understand why the CI is not using the proper database configuration.

image

shows that it uses the "postgres" database, whereas I'm defining this otherwise in tests/settings.py:

if os.environ.get("GITHUB_ACTIONS", False) == "true":
    DATABASES = {
        "default": {
            "ENGINE": "django.contrib.gis.db.backends.postgis",
            "NAME": "umap",
            "USER": "umap",
            "PORT": 5432,
            "PASSWORD": "umap",
        }
    }

@almet almet force-pushed the almet/ci branch 2 times, most recently from 3ae1b17 to 80ffd4d Compare November 22, 2023 17:47
@almet
Copy link
Member Author

almet commented Nov 22, 2023

The error is now, trying to fix it by specifying the HOST.

psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory

@almet almet force-pushed the almet/ci branch 2 times, most recently from 50e2331 to dd7cda0 Compare November 22, 2023 18:04
@almet
Copy link
Member Author

almet commented Nov 22, 2023

Now upgrading the postgres version to 12, as its the minimum required version for Django.

@almet
Copy link
Member Author

almet commented Nov 22, 2023

Now installing playwright :-)

@almet
Copy link
Member Author

almet commented Nov 23, 2023

Playwright is failing with stuff like:

______________________ test_map_load_with_owner[chromium] ______________________

anonymap = <Map: test map>
live_server = <LiveServer listening at http://localhost:50485>
owner_session = <Page url='http://localhost:50485/en/map/test-map_141'>

    def test_map_load_with_owner(anonymap, live_server, owner_session):
        owner_session.goto(f"{live_server.url}{anonymap.get_absolute_url()}")
        map_el = owner_session.locator("#map")
        expect(map_el).to_be_visible()
        enable = owner_session.get_by_role("button", name="Edit")
>       expect(enable).to_be_visible()
E       AssertionError: Locator expected to be visible
E       Actual value: None 
E       Call log:
E       LocatorAssertions.to_be_visible with timeout 5000ms
E       waiting for get_by_role("button", name="Edit")

@yohanboniface
Copy link
Member

Playwright is failing with stuff like:

May be that the HTML is not the map page one, but a 404 or anything like that ?

@almet almet force-pushed the almet/ci branch 6 times, most recently from 34596d1 to 6356517 Compare November 24, 2023 21:16
@almet almet marked this pull request as ready for review November 24, 2023 21:22
@almet almet requested a review from davidbgk November 24, 2023 21:23
]
test = [
"factory-boy==3.2.1",
"playwright==1.38.0",
"playwright>=1.39,<2",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed to be able to support python 3.12.

]
dependencies = [
"Django>=4.1",
"Django>=4.2,<5",
Copy link
Member Author

Choose a reason for hiding this comment

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

The test suite fails otherwise with Django 4.1 (see #1426)

"pytest-playwright==0.4.2",

"pytest-playwright>=0.4.3,<1",
"pytest-xdist>=3.5.0,<4",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is useful to speedup the tests.


if "TRAVIS" in os.environ:
if os.environ.get("GITHUB_ACTIONS", False) == "true":
Copy link
Member Author

Choose a reason for hiding this comment

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

Configuration for Github Actions.

@@ -1,17 +1,18 @@
import json
import socket
from datetime import date, timedelta
from datetime import date, datetime, timedelta
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes warning about datetime that should be time aware.

@almet almet force-pushed the almet/ci branch 2 times, most recently from 33951df to b36c516 Compare November 24, 2023 22:03
umap/settings/base.py Outdated Show resolved Hide resolved
Copy link
Contributor

@davidbgk davidbgk left a comment

Choose a reason for hiding this comment

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

🎁 🙌

@almet almet merged commit 34ee8e8 into master Nov 24, 2023
11 checks passed
@almet almet deleted the almet/ci branch November 24, 2023 22:36
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