78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
name: Integration Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [dev, main]
|
|
|
|
jobs:
|
|
integration-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: userfeedback
|
|
MYSQL_DATABASE: e2e
|
|
MYSQL_USER: userfeedback
|
|
MYSQL_PASSWORD: userfeedback
|
|
TZ: UTC
|
|
ports:
|
|
- 13307:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
smtp:
|
|
image: rnwood/smtp4dev:v3
|
|
ports:
|
|
- 5080:80
|
|
- 25:25
|
|
- 143:143
|
|
|
|
opensearch:
|
|
image: opensearchproject/opensearch:2.17.1
|
|
env:
|
|
discovery.type: single-node
|
|
bootstrap.memory_lock: 'true'
|
|
plugins.security.disabled: 'true'
|
|
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'UserFeedback123!@#'
|
|
options: >-
|
|
--health-cmd="curl -s http://localhost:9200/_cluster/health | grep -q '\"status\":\"green\"'"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
ports:
|
|
- 9200:9200
|
|
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup integration test (with opensearch)
|
|
run: |
|
|
npm install -g corepack@latest
|
|
corepack enable
|
|
pnpm install --frozen-lockfile
|
|
pnpm build
|
|
echo "JWT_SECRET=DEV" >> ./apps/api/.env
|
|
echo "OPENSEARCH_USE=true" >> ./apps/api/.env
|
|
echo "OPENSEARCH_NODE=http://localhost:9200" >> ./apps/api/.env
|
|
echo "SMTP_HOST='localhost'" >> ./apps/api/.env
|
|
echo "SMTP_PORT=25" >> ./apps/api/.env
|
|
echo "SMTP_SENDER='user@feedback.com'" >> ./apps/api/.env
|
|
|
|
- name: Run integration tests (with opensearch)
|
|
run: |
|
|
npm run test:integration
|
|
|
|
- name: Setup integration test (without opensearch)
|
|
run: |
|
|
echo "OPENSEARCH_USE=false" >> ./apps/api/.env
|
|
|
|
- name: Run integration tests (without opensearch)
|
|
run: |
|
|
npm run test:integration
|