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

View File

@ -10,11 +10,9 @@ services:
- 6379:6379
app:
# build: .
image: cupcakearmy/cryptgeon
build: .
env_file: .env
depends_on:
- redis
environment:
SIZE_LIMIT: 10 MiB
ports:
- 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:local": "playwright test --project local",
"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": {
"@playwright/test": "^1.25.1",

View File

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