-
Notifications
You must be signed in to change notification settings - Fork 17
136 lines (109 loc) · 3.68 KB
/
main.yml
File metadata and controls
136 lines (109 loc) · 3.68 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
name: CI
# Controls when the action will run. Triggers the workflow on pushes to main or on pull request events
on:
push:
branches: [ main ]
pull_request:
branches: [ '**' ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Server_Side_Unit_Tests:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Fetch base and install Poetry
run: |
git fetch origin ${{github.base_ref}}
pipx install poetry~=2.1.3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'poetry'
- name: Copy base.html for use in unit tests
run: |
cp --force designsafe/templates/base.j2 designsafe/templates/base.html
- name: Ensure react-assets template exists for use in unit tests
run: |
touch designsafe/templates/base.j2 designsafe/templates/react-assets.html
- run: |
poetry sync
- name: Run Server-side unit tests and generate coverage report
run: |
poetry run pytest --cov-config=.coveragerc --cov=designsafe --cov-report=xml -ra designsafe
Server_Side_Linting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Fetch base and install Poetry
run: |
git fetch origin ${{github.base_ref}}
pipx install poetry~=2.1.3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'poetry'
- name: Install Python Packages
run: |
poetry sync
- name: Run Server-side linting with pytest
# Only run on new files for now-- for all changes, filter is ACMRTUXB
# Check manage.py to prevent a crash if no files are selected.
run: |
poetry run pylint $(git diff --name-only --diff-filter=A origin/${{github.base_ref}} | grep -E "(.py$)") manage.py
- name: Run Server-side formatting with black
run: |
poetry run black $(git diff --name-only --diff-filter=A origin/${{github.base_ref}} | grep -E "(.py$)") manage.py --check
Client_Side_Unit_Tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: npm
- run: npm ci
- run: npm run test
React_NX_unit_tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
working-directory: client
- uses: nrwl/nx-set-shas@v3
# Test/build any apps and libs that have been impacted by the diff.
- run: npx nx affected --target=test --parallel=3 --ci --code-coverage
working-directory: client
- run: npx nx affected --target=build --parallel=3
working-directory: client
React_NX_linting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: client/package-lock.json
- run: npm ci
working-directory: client
- uses: nrwl/nx-set-shas@v3
# Check linting/formatting of workspace files.
- run: npx nx format:check
working-directory: client
# Lint any apps and libs that have been impacted by the diff.
- run: npx nx affected --target=lint --parallel=3
working-directory: client