Package more properly in nix flake format #192
Workflow file for this run
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: "Test" | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- master | |
jobs: | |
test-controller: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
run: | | |
python -m pip install poetry~=1.8.3 | |
- name: Configure poetry | |
run: | | |
python -m poetry config virtualenvs.in-project true | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./controller/.venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
python -m poetry install | |
working-directory: controller | |
- name: Run tests | |
run: | | |
python -m poetry run python -m pytest -sxv | |
working-directory: controller | |
test-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
extra_nix_config: | | |
system-features = kvm | |
extra-trusted-public-keys = cache.thymis.io-1:pEeKkNXiK17TLKls0KM8cEp0NGy08gc5chAmCyuQo8M= | |
extra-substituters = https://cache.thymis.io | |
- uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: | | |
npm ci | |
working-directory: frontend | |
- name: Build application | |
run: | | |
nix build .#thymis-controller | |
- name: Install Playwright Browser | |
run: | | |
npx playwright install --with-deps | |
working-directory: frontend | |
- name: Run tests | |
run: | | |
npm run test | |
env: | |
THYMIS_REPO_PATH: ${{ runner.temp }}/thymis/repository | |
THYMIS_DATABASE_URL: sqlite:///${{ runner.temp }}/thymis/thymis.sqlite | |
THYMIS_AUTH_BASIC_PASSWORD_FILE: ${{ runner.temp }}/thymis/auth-basic-password | |
working-directory: frontend | |
test-pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pre-commit | |
run: | | |
python -m pip install pre-commit | |
- name: Install node dependencies | |
run: | | |
npm ci | |
working-directory: frontend | |
- name: Run pre-commit | |
run: | | |
pre-commit run --all-files | |
test: | |
runs-on: ubuntu-latest | |
needs: [test-controller, test-frontend, test-pre-commit] | |
steps: | |
- run: echo "Build successful" |