Skip to content

fix: compare available settings using JSON.stringify to ensure accura… #681

fix: compare available settings using JSON.stringify to ensure accura…

fix: compare available settings using JSON.stringify to ensure accura… #681

Workflow file for this run

name: "Test"
on:
pull_request:
merge_group:
push:
branches:
- master
jobs:
test-controller:
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
- name: Configure poetry
run: |
nix develop --command 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: |
nix develop --command poetry install
working-directory: controller
- name: Run tests
run: |
nix develop --command 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 2>&1 | tee output.log
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
echo "Playwright tests failed due to a snapshot issue."
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
exit 1
elif grep -q "failed" output.log; then
echo "Playwright tests failed due to a non-snapshot issue."
exit 1
fi
working-directory: frontend
- uses: actions/upload-artifact@v4
id: artifact-upload
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30
- name: Comment on PR with report link
uses: thollander/actions-comment-pull-request@v3
if: ${{ failure() && env.SNAPSHOT_DIFFERENCES == 'true' }}
with:
message: |
### Playwright visual snapshot differences were detected.
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }}) to review the visual differences.
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots
test-pre-commit:
strategy:
matrix:
python-version: ["3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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"