Skip to content

Only generate preaggregated measures SQL where possible #2631

Only generate preaggregated measures SQL where possible

Only generate preaggregated measures SQL where possible #2631

Workflow file for this run

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