Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5f36112
feat: update dependencies and configuration for Redis and Svelte; ref…
absternator Oct 7, 2025
45ec0a9
secure cookie true and mapping 127.0.0.1 ports
M-Kusumgar Oct 7, 2025
c0f6c4f
feat: update Docker Compose to expose Redis and Mintr ports without l…
absternator Oct 7, 2025
62ad3eb
refactor: remove debug logging for user ID and new user state creation
absternator Oct 7, 2025
f962a53
Merge branch 'mrc-6774-strategise-display' of https://github.com/mrc-…
absternator Oct 8, 2025
73b1503
fix: update Redis volume mapping and standardize API reference variable
absternator Oct 8, 2025
60d8cae
feat: add GitHub Actions workflows for building, pushing Docker image…
absternator Oct 8, 2025
7e4709d
fix: reorder steps in test workflow for clarity and consistency
absternator Oct 8, 2025
49ba987
docs: add Docker usage instructions and environment variable examples…
absternator Oct 8, 2025
771a2d7
fix: standardize formatting in GitHub Actions workflows and update RE…
absternator Oct 8, 2025
19b181e
Add unit test coverage command and update dependencies
absternator Oct 8, 2025
fb03763
feat: add Playwright test workflow and update .gitignore to include c…
absternator Oct 8, 2025
e758ef3
fix: standardize variable naming in scripts and improve workflow clarity
absternator Oct 8, 2025
1f87db2
test: enhance test cases for +page.server and +page.svelte components
absternator Oct 8, 2025
7282899
fix: standardize quotes in GitHub Actions workflow configuration
absternator Oct 8, 2025
10f4fda
fix: standardize quote styles in GitHub Actions workflow
absternator Oct 8, 2025
f1e5979
fix: handle undefined REDIS_URL in Redis connection initialization
absternator Oct 8, 2025
57f4051
fix: set default Redis URL to 'redis://localhost:6379' for connection…
absternator Oct 8, 2025
fb72f72
fix: standardize quote styles in GitHub Actions workflow
absternator Oct 8, 2025
65fa133
fix: standardize quote styles in GitHub Actions workflow
absternator Oct 8, 2025
673b0ea
fix: update Playwright configuration to include parallel testing and …
absternator Oct 8, 2025
ae1d34b
fix: update SameSite attribute for userId cookie to 'lax'
absternator Oct 8, 2025
7f69d81
fix: add end-to-end testing workflow to GitHub Actions and remove Pla…
absternator Oct 8, 2025
3e8c929
fix: update README to clarify application readiness before accessing
absternator Oct 8, 2025
e182685
fix: remove trailing space in docker-compose command in README
absternator Oct 8, 2025
34e110c
fix: standardize quotes in workflow files and update Node.js setup
absternator Oct 9, 2025
6ad185d
Merge branch 'mrc-6774-strategise-display' of https://github.com/mrc-…
absternator Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Dockerfile
.dockerignore
.git
.gitignore
.gitattributes
README.md
.npmrc
.prettierrc
.eslintrc.cjs
.graphqlrc
.editorconfig
.svelte-kit
.vscode
node_modules
build
package
**/.env
41 changes: 41 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build and push docker image
on:
push:
branches:
- main
- 'releases/*'
pull_request:
branches:
- '*'
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
IMAGE_NAME: ghcr.io/mrc-ide/mint-frontend

jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? i remember its been on the ci for packit i think, but i dont think we actually needed this right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool have removed.. i just added because it was in the docker action docs


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}
${{ env.BRANCH_NAME == 'main' && format('{0}:latest', env.IMAGE_NAME) || '' }}
64 changes: 64 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: test workflow
on:
push:
branches:
- main
- 'releases/*'
pull_request:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need matrix if we are only testing against one version? or do we plan on testing against different versions? i dont think people usually test against different versions of npm

steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Run format + lint checks
run: npm run lint
- name: check svelte-check
run: npm run check
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run unit tests
run: npm run test:unit:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: mrc-ide/mint-v2
fail_ci_if_error: true
e2e-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Start dependencies
run: ./scripts/run_dependencies.sh
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test:e2e
- name: Stop dependencies
if: ${{ always() }}
run: ./scripts/stop_dependencies.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Thumbs.db
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
coverage
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:22-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
RUN npm prune --omit=dev

FROM builder AS runtime
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,30 @@ npx shadcn-svelte@latest add [component-name]
```

These components will be added to `src/lib/components/ui/` and automatically registered in the SvelteKit app.

## Docker

#### Using Docker Compose

A `compose.yml` file is provided to run the application along with its dependencies (Redis and Mintr API).

1. **Start services**:

```sh
docker-compose up
```
Comment on lines +88 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also include docker compose up --build to rebuild changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not anymore because im using the image from ghcr and not building locally


2. **Access the application**:
Wait for mint-frontend to be ready. Open your browser and navigate to `http://127.0.0.1:3000`.
3. **Stop services**:

```sh
docker-compose down
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation references 'docker-compose.yml' but the actual file is named 'compose.yml'. The commands should use 'docker compose' (without hyphen) for the newer Docker Compose V2 syntax.

Copilot uses AI. Check for mistakes.
```

## Environment Variables

Environment variables can be set in a `.env` file in the root directory or added to the environment. Example variables include:

- `FRONTEND_REF`: Git reference for the frontend image (default: `main`)
- `API_REF`: Git reference for the Mintr API image (default: `main`)
37 changes: 37 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
mint-redis:
image: redis:8.0
ports:
- 6379:6379
volumes:
- mint-data:/data
container_name: mint-redis
mint-frontend:
image: ghcr.io/mrc-ide/mint-frontend:${FRONTEND_REF:-main}
pull_policy: always
ports:
- 127.0.0.1:3000:3000
environment:
- REDIS_URL=redis://mint-redis:6379
- PUBLIC_MINTR_URL=http://mintr:8888
- ORIGIN=http://127.0.0.1:3000
depends_on:
mint-redis:
condition: service_started
mintr:
condition: service_healthy
restart: true
mintr:
image: ghcr.io/mrc-ide/mintr:${API_REF:-main}
container_name: mintr
healthcheck:
test: curl -f http://localhost:8888/ || exit 1
start_period: 1m
start_interval: 10s
interval: 1m
timeout: 30s
retries: 5
ports:
- 8888:8888
volumes:
mint-data:
1 change: 0 additions & 1 deletion e2e/demo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import { expect, test } from '@playwright/test';

test('home page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toBeVisible();
await expect(page.getByText('Mint')).toBeVisible();
});
Loading