Skip to content

Reminder to check for MOJ ip address updates #752

Reminder to check for MOJ ip address updates

Reminder to check for MOJ ip address updates #752

name: Run tests
on:
pull_request:
types: [opened, edited, reopened, synchronize]
workflow_call:
jobs:
datahub-client-path-filter:
runs-on: ubuntu-latest
outputs:
datahub-client: ${{ steps.changes.outputs.datahub-client }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
datahub-client:
- 'lib/datahub-client/**'
datahub-client-tests:
name: Run datahub client tests
needs: datahub-client-path-filter
if: ${{ needs.datahub-client-path-filter.outputs.datahub-client == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: lib/datahub-client
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version:
- "3.10"
steps:
- name: Checkout repository
uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.4
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: lib/datahub-client/poetry.lock
- name: Poetry install
run: |
poetry install
- name: Run tests
run: |
poetry run pytest
python-tests:
name: Python tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"
cache: poetry
cache-dependency-path: ./poetry.lock
- name: Install project
run: |
make install_python_deps
make install_npm_deps
poetry install --no-interaction --no-root
sudo apt-get install gettext
- name: Make compilemessages
run: make compilemessages
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
- name: Get npm cache directory
id: npm-cache-dir
run: make export_npm_cache_dir
- name: Load cached npm
uses: actions/cache@v4
with:
path: $(cat .npm_cache_dir)
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build frontend assets
run: make assets
- name: Run unit tests with coverage
id: fast-tests
run: TESTING=True poetry run pytest --cov -m 'not slow and not datahub' --doctest-modules
- name: Set up chromedriver
# https://github.com/marketplace/actions/setup-chromedriver
uses: nanasess/setup-chromedriver@v2.2.2
- name: Run integration tests
id: slow-tests
if: steps.fast-tests.outcome == 'success'
run: make integration
javascript-only-tests:
name: Javascript tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
- name: Get npm cache directory
id: npm-cache-dir
run: make export_npm_cache_dir
- name: Load cached npm
uses: actions/cache@v4
with:
path: $(cat .npm_cache_dir)
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
id: install_dependencies
run: npm install
- name: Run javascript tests
run: npm test