-
Notifications
You must be signed in to change notification settings - Fork 12
127 lines (122 loc) · 4.01 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: CI tests
on:
pull_request:
branches: [dev, main, 331-staging]
jobs:
event_file:
name: Event File
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
backend_lint:
name: Backend Pylint
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Install pylint
run: pip install pylint
- name: Analysing the code with pylint
run: pylint $(git ls-files '*.py')
backend_typecheck:
name: Backend Mypy
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Run mypy checks
run: python -m mypy .
working-directory: ./backend
backend_tests:
name: Backend Unit Tests
runs-on: ubuntu-latest
permissions: # required for artifacts
checks: write
pull-requests: write
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-backend
- name: Setup environment
uses: ./.github/actions/setup-ci-env
- name: Run the backend container
run: docker compose up --wait --wait-timeout 90 ci-backend
- name: Log the backend container output
run: docker compose logs ci-backend
if: always()
- name: Test algorithm with pytest
run: |
pip install pytest-cov
python -m pytest --junitxml=junit/be-test-results.xml --cov=. --cov-report=xml --cov-report=html
working-directory: ./backend
- uses: actions/upload-artifact@v3 # upload test results
if: always()
with:
name: be-test-results
path: backend/junit/be-test-results.xml # Path to test results
frontend_lint:
name: Frontend Eslint
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Run eslint on frontend
run: ls && npm run lint
working-directory: ./frontend
frontend_typecheck:
name: Frontend Typechecks
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Typecheck the frontend
run: npm run types
working-directory: ./frontend
frontend_tests:
name: Frontend Unit Tests
runs-on: ubuntu-latest
if: false
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Install deps
uses: ./.github/actions/setup-ci-frontend
- name: Run the unit tests on frontend
run: npm run test
working-directory: ./frontend
- uses: actions/upload-artifact@v3
if: always()
with:
name: fe-test-results
path: frontend/junit/fe-test-results.xml
docker_build:
name: Build docker containers
runs-on: ubuntu-latest
needs: [backend_lint, backend_typecheck, backend_tests, frontend_lint, frontend_typecheck] # TODO: add test jobs when they get unskipped
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-ci-env
- name: Check the backend successfully builds
run: docker compose build backend-prod
- name: Check the frontend successfully builds
run: docker compose build frontend-prod
- name: Check that we can successfully start the containers
run: docker compose up --wait --wait-timeout 90 backend-prod frontend-prod
- name: Log the output of the containers
run: docker compose logs backend-prod frontend-prod
if: always()