-
-
Notifications
You must be signed in to change notification settings - Fork 88
148 lines (126 loc) · 4.39 KB
/
Copy pathweb.yml
File metadata and controls
148 lines (126 loc) · 4.39 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Web Tests/Analysis
on:
push:
branches:
- develop
- main
paths:
- '.github/workflows/web.yml'
- 'easyinstall.sh'
- 'python/**'
pull_request:
branches:
- develop
- main
types:
- opened
- synchronize
- reopened
paths:
- '.github/workflows/web.yml'
- 'easyinstall.sh'
- 'python/**'
jobs:
backend_checks:
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.9.25
cache: 'pip'
- run: pip install -r web/requirements-dev.txt
id: pip
- run: black --check .
- run: flake8 .
if: success() || failure() && steps.pip.outcome == 'success'
backend_tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docker
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set backend container image name
run: |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
IMAGE_TAG=$(git ls-files -s cpp proto .github/workflows/web.yml | git hash-object --stdin)
echo "GHCR_IMAGE=ghcr.io/${REPO_LOWER}/backend-standalone:${IMAGE_TAG}" >> $GITHUB_ENV
- name: Login to container registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and launch containers
run: docker compose -f docker-compose.ci.yml up -d
- name: Run test suite
run: docker compose -f docker-compose.ci.yml run pytest -v
- name: Push backend image to container registry
if: |
(success() || failure())
&& github.actor != 'dependabot[bot]'
&& github.actor != 'dependabot'
&& (
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
run: docker compose -f docker-compose.ci.yml push backend
- name: Upload test artifacts
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pytest-output.zip
path: |
docker/volumes/pytest/report.xml
docker/volumes/pytest/pytest.log
- name: Output container logs
if: success() || failure()
run: |
docker compose -f docker-compose.ci.yml logs backend > backend.log
docker compose -f docker-compose.ci.yml logs web > web.log
docker compose -f docker-compose.ci.yml logs -t | sort -u -k 3 > combined.log
- name: Upload backend log
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: backend.log
path: docker/backend.log
- name: Upload web log
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: web.log
path: docker/web.log
- name: Upload combined log
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: combined.log
path: docker/combined.log
frontend_checks:
runs-on: ubuntu-latest
defaults:
run:
working-directory: python/web
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
cache: 'npm'
cache-dependency-path: python/web/package-lock.json
- run: npm ci
id: npm
- name: Stylelint
run: |
npx stylelint src/static/themes/modern/style.css
npx stylelint src/static/themes/classic/style.css
- name: Prettier
run: |
npx prettier --check src/static/themes/modern/style.css
npx prettier --check src/static/themes/classic/style.css
if: success() || failure() && steps.npm.outcome == 'success'