test on docker image

This commit is contained in:
cupcakearmy 2022-11-14 15:47:12 +01:00
parent cb80c8bfe4
commit 7a045b3f34
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
5 changed files with 34 additions and 17 deletions

View File

@ -19,14 +19,15 @@ jobs:
- name: Build and push - name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
tags: cupcakearmy/cryptgeon:test
push: false push: false
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: # services:
redis: # redis:
image: redis:7-alpine # image: redis:7-alpine
ports: # ports:
- 6379:6379 # - 6379:6379
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
@ -35,19 +36,18 @@ jobs:
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v2
with: with:
version: 7 version: 7
- uses: actions-rs/toolchain@v1 # - uses: actions-rs/toolchain@v1
with: # with:
toolchain: 1.64 # toolchain: 1.64
- name: Prepare - name: Prepare
run: | run: |
pnpm install pnpm install
pnpm run test:prepare pnpm run test:docker
- name: Install Playwright - name: Install Playwright
run: npx playwright install --with-deps run: npx playwright install --with-deps
- name: Run your tests - name: Run your tests
run: pnpm run test:run run: pnpm run test:run
- name: Upload test results - name: Upload test results
if: always()
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: test-results name: test-results

View File

@ -10,11 +10,9 @@ services:
- 6379:6379 - 6379:6379
app: app:
# build: . build: .
image: cupcakearmy/cryptgeon env_file: .env
depends_on: depends_on:
- redis - redis
environment:
SIZE_LIMIT: 10 MiB
ports: ports:
- 1234:5000 - 1234:5000

18
docker-compose.yaml Normal file
View File

@ -0,0 +1,18 @@
version: '3.8'
services:
redis:
image: redis:7-alpine
# Set a size limit. See link below on how to customise.
# https://redis.io/docs/manual/eviction/
# command: redis-server --maxmemory 1gb --maxmemory-policy allkeys-lru
app:
image: cupcakearmy/cryptgeon:latest
depends_on:
- redis
environment:
# Size limit for a single note.
SIZE_LIMIT: 4 MiB
ports:
- 80:5000

View File

@ -7,7 +7,8 @@
"test:run": "playwright test --project chrome firefox safari", "test:run": "playwright test --project chrome firefox safari",
"test:local": "playwright test --project local", "test:local": "playwright test --project local",
"test:server": "pnpm --parallel run test:server", "test:server": "pnpm --parallel run test:server",
"test:prepare": "pnpm --parallel run test:prepare" "test:prepare": "pnpm --parallel run test:prepare",
"test:docker": "docker compose -f docker-compose.dev.yaml build"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.25.1", "@playwright/test": "^1.25.1",

View File

@ -10,10 +10,10 @@ const config: PlaywrightTestConfig = {
outputDir: './test-results', outputDir: './test-results',
testDir: './test', testDir: './test',
timeout: 60_000, timeout: 60_000,
testIgnore: ['file/too-big.spec.ts'], // testIgnore: ['file/too-big.spec.ts'],
webServer: { webServer: {
command: 'pnpm run test:server', command: 'docker compose -f docker-compose.dev.yaml up',
port: 1234, port: 1234,
reuseExistingServer: true, reuseExistingServer: true,
}, },