diff --git a/.github/ci.env b/.github/ci.env index 18b4e43dd..58816a252 100644 --- a/.github/ci.env +++ b/.github/ci.env @@ -22,6 +22,12 @@ MYSQL_USER=std_notes_user MYSQL_PASSWORD=changeme123 MYSQL_ROOT_PASSWORD=changeme123 +MONGO_HOST=localhost +MONGO_PORT=27017 +MONGO_USERNAME=standardnotes +MONGO_PASSWORD=standardnotes +MONGO_DATABASE=standardnotes + AUTH_JWT_SECRET=f95259c5e441f5a4646d76422cfb3df4c4488842901aa50b6c51b8be2e0040e9 AUTH_SERVER_ENCRYPTION_SERVER_KEY=1087415dfde3093797f9a7ca93a49e7d7aa1861735eb0d32aae9c303b8c3d060 VALET_TOKEN_SECRET=4b886819ebe1e908077c6cae96311b48a8416bd60cc91c03060e15bdf6b30d1f diff --git a/.github/workflows/common-e2e.yml b/.github/workflows/common-e2e.yml index 382bf2c4e..3a2482f79 100644 --- a/.github/workflows/common-e2e.yml +++ b/.github/workflows/common-e2e.yml @@ -20,6 +20,10 @@ on: jobs: e2e: name: (Docker) E2E Test Suite + strategy: + fail-fast: false + matrix: + secondary_db_enabled: [true, false] runs-on: ubuntu-latest services: @@ -45,6 +49,7 @@ jobs: env: DB_TYPE: mysql CACHE_TYPE: redis + SECONDARY_DB_ENABLED: ${{ matrix.secondary_db_enabled }} - name: Wait for server to start run: docker/is-available.sh http://localhost:3123 $(pwd)/logs @@ -67,13 +72,7 @@ jobs: matrix: db_type: [mysql, sqlite] cache_type: [redis, memory] - include: - - cache_type: redis - db_type: mysql - redis_port: 6380 - - cache_type: redis - db_type: sqlite - redis_port: 6381 + secondary_db_enabled: [true, false] runs-on: ubuntu-latest @@ -85,16 +84,24 @@ jobs: cache: image: redis ports: - - ${{ matrix.redis_port }}:6379 + - 6379:6379 db: image: mysql ports: - - 3307:3306 + - 3306:3306 env: MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: standardnotes_${{ matrix.cache_type }} + MYSQL_DATABASE: standardnotes MYSQL_USER: standardnotes MYSQL_PASSWORD: standardnotes + secondary_db: + image: mongo:5.0 + ports: + - 27017:27017 + env: + MONGO_INITDB_ROOT_USERNAME: standardnotes + MONGO_INITDB_ROOT_PASSWORD: standardnotes + MONGO_INITDB_DATABASE: standardnotes steps: - uses: actions/checkout@v3 @@ -125,14 +132,20 @@ jobs: echo "REFRESH_TOKEN_AGE=10" >> packages/home-server/.env echo "REVISIONS_FREQUENCY=2" >> packages/home-server/.env echo "DB_HOST=localhost" >> packages/home-server/.env - echo "DB_PORT=3307" >> packages/home-server/.env - echo "DB_DATABASE=standardnotes_${{ matrix.cache_type }}" >> packages/home-server/.env - echo "DB_SQLITE_DATABASE_PATH=sqlite_${{ matrix.cache_type }}.db" >> packages/home-server/.env + echo "DB_PORT=3306" >> packages/home-server/.env + echo "DB_DATABASE=standardnotes" >> packages/home-server/.env + echo "DB_SQLITE_DATABASE_PATH=homeserver.db" >> packages/home-server/.env echo "DB_USERNAME=standardnotes" >> packages/home-server/.env echo "DB_PASSWORD=standardnotes" >> packages/home-server/.env echo "DB_TYPE=${{ matrix.db_type }}" >> packages/home-server/.env - echo "REDIS_URL=redis://localhost:${{ matrix.redis_port }}" >> packages/home-server/.env + echo "REDIS_URL=redis://localhost:6380" >> packages/home-server/.env echo "CACHE_TYPE=${{ matrix.cache_type }}" >> packages/home-server/.env + echo "SECONDARY_DB_ENABLED=${{ matrix.secondary_db_enabled }}" >> packages/home-server/.env + echo "MONGO_HOST=localhost" >> packages/home-server/.env + echo "MONGO_PORT=27017" >> packages/home-server/.env + echo "MONGO_DATABASE=standardnotes" >> packages/home-server/.env + echo "MONGO_USERNAME=standardnotes" >> packages/home-server/.env + echo "MONGO_PASSWORD=standardnotes" >> packages/home-server/.env echo "FILES_SERVER_URL=http://localhost:3123" >> packages/home-server/.env echo "E2E_TESTING=true" >> packages/home-server/.env diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 097fea53c..08161d969 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -23,6 +23,7 @@ services: environment: DB_TYPE: "${DB_TYPE}" CACHE_TYPE: "${CACHE_TYPE}" + SECONDARY_DB_ENABLED: "${SECONDARY_DB_ENABLED}" container_name: server-ci ports: - 3123:3000 @@ -61,6 +62,21 @@ services: networks: - standardnotes_self_hosted + secondary_db: + image: mongo:5.0 + container_name: secondary_db-ci + expose: + - 27017 + restart: unless-stopped + volumes: + - ./data/mongo:/data/db + env: + MONGO_INITDB_ROOT_USERNAME: standardnotes + MONGO_INITDB_ROOT_PASSWORD: standardnotes + MONGO_INITDB_DATABASE: standardnotes + networks: + - standardnotes_self_hosted + cache: image: redis:6.0-alpine container_name: cache-ci