|
1 | 1 | version: 2 |
2 | | -executors: |
3 | | - main_executor: |
4 | | - machine: |
5 | | - image: ubuntu-2204:2024.01.2 |
6 | | - resource_class: large |
| 2 | + |
7 | 3 | jobs: |
8 | | - build: |
| 4 | + test: |
9 | 5 | machine: |
10 | 6 | image: ubuntu-2204:2024.01.2 |
11 | 7 | resource_class: large |
12 | 8 | steps: |
13 | 9 | - checkout |
14 | | - - run: |
15 | | - # NOTE: To connect to this, use an SSH tunnel in front, like so.. |
16 | | - # |
17 | | - # In one terminal: |
18 | | - # $ ssh -p PORT ubuntu@CIRCLE_IP_ADDRESS -L 5900:localhost:5900 |
19 | | - # |
20 | | - # In another terminal: |
21 | | - # $ open vnc://0.0.0.0:5900 |
22 | | - name: "Setup: Enable VNC access" |
23 | | - command: | |
24 | | - sudo apt-get update |
25 | | - sudo apt-get install -y x11vnc |
26 | | - # x11vnc -forever -nopw |
27 | | - background: true |
28 | | - |
29 | 10 | - run: |
30 | 11 | name: "Setup: Copy environment variables" |
31 | 12 | command: cp .env_circleci .env |
32 | 13 |
|
33 | 14 | - run: |
34 | 15 | name: "Setup: Create directories for MinIO (cannot be made by docker for some reason)" |
35 | 16 | command: | |
36 | | - sudo mkdir -p var/minio/public |
37 | | - sudo mkdir -p var/minio/private |
| 17 | + mkdir -p var/minio/public |
| 18 | + mkdir -p var/minio/private |
38 | 19 | - run: |
39 | 20 | name: "Setup: Prepare the playwright environment" |
40 | 21 | command: | |
41 | | - cd tests |
42 | | - yarn install |
43 | | - background: true |
| 22 | + cd playwrightPython |
| 23 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 24 | + $HOME/.local/bin/uv sync |
| 25 | + $HOME/.local/bin/uv run playwright install --with-deps |
44 | 26 | - run: |
45 | 27 | name: "Docker: Build containers and collect static files" |
46 | 28 | command: | |
47 | | - docker compose -f docker-compose.yml -f docker-compose.selenium.yml -f docker-compose.playwright.yml up -d |
| 29 | + docker compose -f docker-compose.yml -f docker-compose.selenium.yml up -d |
48 | 30 | docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django python manage.py collectstatic --noinput |
49 | 31 | docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django python manage.py migrate |
50 | 32 | docker compose -f docker-compose.yml exec django python ./manage.py createsuperuser --no-input |
51 | 33 |
|
| 34 | + - run: |
| 35 | + name: "Lint: Check code style with flake8" |
| 36 | + command: docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django flake8 src/ |
| 37 | + |
52 | 38 | - run: |
53 | 39 | name: "Docker: Pull required images" |
54 | 40 | # not available without "not e2e" tests as they pull ahead of time |
55 | 41 | command: | |
56 | 42 | docker pull codalab/codalab-legacy:py37 |
57 | | - docker pull codalab/codalab-legacy:py3 |
58 | | - docker pull vergilgxw/autotable:v2 |
59 | | - background: true |
60 | | - linter: |
61 | | - machine: |
62 | | - image: ubuntu-2204:2024.01.2 |
63 | | - resource_class: large |
64 | | - steps: |
65 | | - - run: |
66 | | - name: "Lint: Check code style with flake8" |
67 | | - command: docker-compose exec django flake8 src/ |
68 | | - - store_artifacts: |
69 | | - path: artifacts/ |
70 | | - unit_tests: |
71 | | - machine: |
72 | | - image: ubuntu-2204:2024.01.2 |
73 | | - resource_class: large |
74 | | - steps: |
| 43 | + docker pull codalab/codalab-legacy:py3 |
| 44 | +
|
75 | 45 | - run: |
76 | 46 | name: "Tests: Run unit/integration tests (excluding e2e)" |
77 | 47 | command: docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django py.test src/ -m "not e2e" |
78 | | - - store_artifacts: |
79 | | - path: artifacts/ |
80 | | - e2e_tests: |
81 | | - machine: |
82 | | - image: ubuntu-2204:2024.01.2 |
83 | | - resource_class: large |
84 | | - steps: |
| 48 | + |
85 | 49 | # - run: |
86 | 50 | # name: "Tests: Run end-to-end (E2E) tests" |
87 | 51 | # command: docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django py.test src/tests/functional/ -m e2e |
88 | 52 | # no_output_timeout: 60m |
89 | 53 | - run: |
90 | 54 | name: "Tests: Run end-to-end (E2E) tests" |
91 | 55 | command: | |
92 | | - cd tests && PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3000/ yarn playwright test |
93 | | - no_output_timeout: 10m |
| 56 | + cd playwrightPython && $HOME/.local/bin/uv run pytest test_auth.py test_account_creation.py test_submission.py |
| 57 | + no_output_timeout: 30m |
| 58 | + |
94 | 59 | # Example to run specific set of tests (for debugging individual tests from a batch of tests) |
95 | 60 | # - run: |
96 | 61 | # name: e2e tests - competitions |
97 | 62 | # command: docker compose -f docker-compose.yml -f docker-compose.selenium.yml exec django py.test src/tests/functional/test_competitions.py -m e2e |
98 | 63 | # no_output_timeout: 60m |
99 | 64 |
|
| 65 | + - store_artifacts: |
| 66 | + path: artifacts/ |
| 67 | + |
100 | 68 | workflows: |
101 | 69 | version: 2 |
102 | 70 | build_and_test: |
103 | 71 | jobs: |
104 | | - - build |
105 | | - - linter: |
106 | | - requires: |
107 | | - - build |
108 | | - - unit_tests: |
109 | | - requires: |
110 | | - - build |
111 | | - - linter |
112 | | - - e2e_tests: |
113 | | - requires: |
114 | | - - build |
115 | | - - linter |
| 72 | + - test |
0 commit comments