-
Notifications
You must be signed in to change notification settings - Fork 15
161 lines (145 loc) · 5.3 KB
/
test.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: "PR Update : Run tests and linters"
on:
pull_request:
branches: [ main ]
paths-ignore:
# python
- datajunction-clients/python/__about__.py
- datajunction-server/datajunction_server/__about__.py
- datajunction-query/djqs/__about__.py
- datajunction-reflection/datajunction_reflection/__about__.py
# javascript
- datajunction-clients/javascript/package.json
- datajunction-ui/package.json
# java: TODO
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
env:
PDM_DEPS: 'urllib3<2'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
library: ['client', 'server', 'djqs', 'djrs']
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
client:
- 'datajunction-clients/python/**'
# run Python unit tests also when server is updated (because server changes can break the client)
- 'datajunction-server/**'
- '!**/__about__.py'
server:
- 'datajunction-server/**'
- '!**/__about__.py'
djqs:
- 'datajunction-query/**'
- '!**/__about__.py'
djrs:
- 'datajunction-reflection/**'
- '!**/__about__.py'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: ${{ matrix.python-version }}
architecture: x64
prerelease: true
enable-pep582: true
- uses: pre-commit/action@v3.0.0
name: Force check of all pdm.lock files
with:
extra_args: pdm-lock-check --all-files
- name: Run Tests
if: |
(matrix.library == 'client' && steps.filter.outputs.client == 'true') ||
(matrix.library == 'server' && steps.filter.outputs.server == 'true') ||
(matrix.library == 'djqs' && steps.filter.outputs.djqs == 'true') ||
(matrix.library == 'djrs' && steps.filter.outputs.djrs == 'true')
run: |
echo "Testing ${{ matrix.library }} ..."
export TEST_DIR=${{ matrix.library == 'server' && './datajunction-server' || matrix.library == 'client' && './datajunction-clients/python' || matrix.library == 'djqs' && './datajunction-query' || matrix.library == 'djrs' && './datajunction-reflection'}}
# Install dependencies
pdm sync -d; cd $TEST_DIR; pdm install -d -G pandas -G transpilation -G test;
# Run linters
pdm run pre-commit run --all-files
# Run tests
export MODULE=${{ matrix.library == 'server' && 'datajunction_server' || matrix.library == 'client' && 'datajunction' || matrix.library == 'djqs' && 'djqs' || matrix.library == 'djrs' && 'datajunction_reflection'}}
pdm run pytest ${{ (matrix.library == 'server' || matrix.library == 'client') && '-n auto' || '' }} --cov-fail-under=100 --cov=$MODULE --cov-report term-missing -vv tests/ --doctest-modules $MODULE --without-integration --without-slow-integration
build-javascript:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dev Dependencies
run: npm install --only=dev
working-directory: ./datajunction-clients/javascript
- name: Build Javascript Client
run: npm run build
working-directory: ./datajunction-clients/javascript
- name: Lint Javascript Client
run: npm run lint
working-directory: ./datajunction-clients/javascript
build-ui:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./datajunction-ui
strategy:
matrix:
node-version: [19.x]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: yarn install
- name: Run Lint
run: yarn lint --fix
- name: Run Prettier
run: yarn prettier . --write
- name: Run Unit Tests
run: yarn test --runInBand --ci --coverage
- name: Build Project
run: yarn webpack-build
build-java:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./datajunction-clients/java
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Official Gradle Wrapper Validation Action
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build -x test
build-root-directory: ./datajunction-clients/java