-
Notifications
You must be signed in to change notification settings - Fork 9
144 lines (114 loc) · 3.57 KB
/
ci.yaml
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
# Workflow for continuous integration
name: Continuous integration
on:
push:
branches:
- development
- master
pull_request:
branches:
- development
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Frontend
ci-frontend:
runs-on: ${{ matrix.os }} # Use matrix os to run on multiple os
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Print concurrency group
run: |
echo "${{ github.workflow }}-${{ github.ref }}"
- name: Get node version
id: get-node-version
working-directory: web/autosubliminal
run: |
echo "node-version=$(jq -r '.engines.node' package.json | sed 's/[>=]//g')" >> $GITHUB_OUTPUT
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
- name: Print node version
run: |
echo "Node version $(node --version)"
echo "Npm version $(npm --version)"
- name: Install npm dependencies
working-directory: web/autosubliminal
run: |
npm install
- name: Build angular code
working-directory: web/autosubliminal
run: |
npm run build-ci
- name: Lint angular code
working-directory: web/autosubliminal
run: |
npm run lint
# Backend
ci-backend:
runs-on: ${{ matrix.os }} # Use matrix os to run on multiple os
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
defaults:
run:
shell: bash # required for poetry
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Print concurrency group
run: |
echo "${{ github.workflow }}-${{ github.ref }}"
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Print python version
run: |
python --version
- name: Setup poetry
uses: snok/install-poetry@v1
- name: Print poetry version
run: |
poetry --version
- name: Install python dependencies
run: |
poetry install --no-interaction
- name: Lint python code
run: |
poetry run ruff check # Configuration is done in pyproject.toml
- name: Type check python code
run: |
poetry run mypy # Configuration is done in pyproject.toml
- name: Test python code
run: |
poetry run coverage run --module pytest # Configuration is done in pyproject.toml
- name: Generate coverage report
run: |
poetry run coverage lcov
- name: Show coverage report
run: |
poetry run coverage report
- name: Publish python coverage report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ matrix.os }}-python-${{ matrix.python-version }}
file: coverage.lcov # although it's autodetected, removing it, causes issues on windows builds, so keep it
parallel: true
ci-backend-finish:
needs: ci-backend
runs-on: ubuntu-latest
steps:
- name: Aggregate python coverage reports
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true