Impact analysis deploy #5402
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |