-
Notifications
You must be signed in to change notification settings - Fork 23
168 lines (150 loc) · 5.59 KB
/
test.yml
File metadata and controls
168 lines (150 loc) · 5.59 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: "PR Update : Run tests and linters"
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
outputs:
client: ${{ steps.filter.outputs.client }}
server: ${{ steps.filter.outputs.server }}
djqs: ${{ steps.filter.outputs.djqs }}
djrs: ${{ steps.filter.outputs.djrs }}
ui: ${{ steps.filter.outputs.ui }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
token: ''
filters: |
client:
- datajunction-clients/python/**
- '!datajunction-clients/python/datajunction/__about__.py'
server:
- datajunction-server/**
- '!datajunction-server/datajunction_server/__about__.py'
djqs:
- datajunction-query/**
- '!**/__about__.py'
djrs:
- datajunction-reflection/**
- '!**/__about__.py'
ui:
- datajunction-ui/**
- '!datajunction-ui/package.json'
predicate-quantifier: every
build:
needs: changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
library: ['client', 'server', 'djqs', 'djrs']
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Run Tests
if: |
(matrix.library == 'client' && (needs.changes.outputs.client == 'true' || needs.changes.outputs.server == 'true')) ||
(matrix.library == 'server' && needs.changes.outputs.server == 'true') ||
(matrix.library == 'djqs' && needs.changes.outputs.djqs == 'true') ||
(matrix.library == 'djrs' && needs.changes.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'}}
cd $TEST_DIR
# Install dependencies (each package has different extras)
if [ "${{ matrix.library }}" = "server" ]; then
uv sync --group test --extra transpilation --python ${{ matrix.python-version }}
elif [ "${{ matrix.library }}" = "client" ]; then
uv sync --group test --extra pandas --extra mcp --python ${{ matrix.python-version }}
else
uv sync --group test --python ${{ matrix.python-version }}
fi
# Run linters
uv 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'}}
uv run pytest ${{ (matrix.library == 'server' || matrix.library == 'client') && '-n auto --dist=loadscope' || '' }} --cov-fail-under=100 --cov=$MODULE --cov-report term-missing -vv tests/ --doctest-modules $MODULE --without-integration --without-slow-integration --ignore=datajunction_server/alembic/env.py
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:
needs: changes
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
if: ${{ needs.changes.outputs.ui == 'true' }}
run: yarn install --ignore-engines
- name: Run Lint and Prettier
if: ${{ needs.changes.outputs.ui == 'true' }}
run: |
yarn lint --fix
yarn prettier . --write
git diff --exit-code
- name: Run Unit Tests and Build
if: ${{ needs.changes.outputs.ui == 'true' }}
run: |
yarn test --runInBand --ci --coverage
yarn webpack-build
build-java:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./datajunction-clients/java
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build -x test