This file contains 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: Run HCI code check | |
on: [push, pull_request] | |
env: | |
HCI_ROOT_DIR: "." | |
permissions: | |
contents: read | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Set up Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Cache Python dependencies (or restore previously cached) | |
id: python-cache | |
uses: actions/cache@v4 | |
with: | |
path: venv # It's important to have a single directory that gets cached. | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python dependencies | |
if: steps.python-cache.outputs.cache-hit != 'true' | |
run: python -m venv venv && source ./venv/bin/activate && pip install -r requirements.txt | |
- name: Cache NPM dependencies (or restore previously cached) | |
id: npm-cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules # It's important to have a single directory that gets cached. | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install NPM dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Format the front end and back end code | |
run: source ./venv/bin/activate && invoke fmt | |
- name: Lint the front end and back end code | |
run: source ./venv/bin/activate && invoke lint | |
- name: Type check the front end and back end code | |
run: source ./venv/bin/activate && invoke types | |
- name: Run front end and back end tests | |
run: source ./venv/bin/activate && invoke test |