mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge branch 'master' into refactor-backend-testing-workflow
This commit is contained in:
commit
3a1d47895d
87
.github/workflows/test-e2e.yml
vendored
87
.github/workflows/test-e2e.yml
vendored
@ -3,41 +3,43 @@ name: ocelot.social end-to-end test CI
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
prepare_neo4j_image:
|
||||
name: Fullstack | prepare neo4j image
|
||||
prepare_backend_environment:
|
||||
name: Fullstack | prepare backend environment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
|
||||
- name: Build docker image
|
||||
- name: Copy backend env file
|
||||
run: |
|
||||
docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/
|
||||
docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/neo4j.tar
|
||||
cp backend/.env.test_e2e backend/.env
|
||||
cp webapp/.env.template webapp/.env
|
||||
|
||||
- name: Build backend and dependencies
|
||||
run: |
|
||||
# Build and start all required images for backend
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend --build
|
||||
|
||||
# Save the build images
|
||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j-community:test" > /tmp/neo4j.tar
|
||||
docker save "quay.io/minio/minio:latest" > /tmp/minio.tar
|
||||
docker save "quay.io/minio/mc:latest" > /tmp/minio-mc.tar
|
||||
docker save "maildev/maildev:latest" > /tmp/mailserver.tar
|
||||
|
||||
# Stop the containers
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml down
|
||||
|
||||
- name: Cache docker image
|
||||
- name: Cache docker images
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
with:
|
||||
path: /tmp/neo4j.tar
|
||||
key: ${{ github.run_id }}-e2e-neo4j-cache
|
||||
|
||||
prepare_backend_image:
|
||||
name: Fullstack | prepare backend image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
|
||||
docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar
|
||||
|
||||
- name: Cache docker image
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
with:
|
||||
path: /tmp/backend.tar
|
||||
key: ${{ github.run_id }}-e2e-backend-cache
|
||||
path: |
|
||||
/tmp/backend.tar
|
||||
/tmp/neo4j.tar
|
||||
/tmp/minio.tar
|
||||
/tmp/minio-mc.tar
|
||||
/tmp/mailserver.tar
|
||||
key: ${{ github.run_id }}-e2e-backend-environment-cache
|
||||
|
||||
prepare_webapp_image:
|
||||
name: Fullstack | prepare webapp image
|
||||
@ -46,10 +48,15 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
|
||||
- name: Copy backend env file
|
||||
run: |
|
||||
cp backend/.env.test_e2e backend/.env
|
||||
cp webapp/.env.template webapp/.env
|
||||
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
||||
docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach webapp --build --no-deps
|
||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
||||
|
||||
- name: Cache docker image
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
@ -91,7 +98,7 @@ jobs:
|
||||
fullstack_tests:
|
||||
name: Fullstack | tests
|
||||
if: success()
|
||||
needs: [prepare_neo4j_image, prepare_backend_image, prepare_webapp_image, prepare_cypress]
|
||||
needs: [prepare_backend_environment, prepare_webapp_image, prepare_cypress]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
jobs: 8
|
||||
@ -110,17 +117,16 @@ jobs:
|
||||
key: ${{ github.run_id }}-e2e-cypress
|
||||
restore-keys: ${{ github.run_id }}-e2e-cypress
|
||||
|
||||
- name: Restore neo4j cache
|
||||
- name: Restore backend environment cache
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
with:
|
||||
path: /tmp/neo4j.tar
|
||||
key: ${{ github.run_id }}-e2e-neo4j-cache
|
||||
|
||||
- name: Restore backend cache
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
with:
|
||||
path: /tmp/backend.tar
|
||||
key: ${{ github.run_id }}-e2e-backend-cache
|
||||
path: |
|
||||
/tmp/backend.tar
|
||||
/tmp/neo4j.tar
|
||||
/tmp/minio.tar
|
||||
/tmp/minio-mc.tar
|
||||
/tmp/mailserver.tar
|
||||
key: ${{ github.run_id }}-e2e-backend-environment-cache
|
||||
|
||||
- name: Restore webapp cache
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2
|
||||
@ -134,8 +140,11 @@ jobs:
|
||||
sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter
|
||||
docker load < /tmp/neo4j.tar
|
||||
docker load < /tmp/backend.tar
|
||||
docker load < /tmp/minio.tar
|
||||
docker load < /tmp/minio-mc.tar
|
||||
docker load < /tmp/mailserver.tar
|
||||
docker load < /tmp/webapp.tar
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --build --detach webapp mailserver
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
||||
sleep 90s
|
||||
|
||||
- name: Full stack tests | run tests
|
||||
|
||||
@ -32,10 +32,12 @@ COMMIT=
|
||||
PUBLIC_REGISTRATION=false
|
||||
INVITE_REGISTRATION=true
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_ENDPOINT=
|
||||
AWS_REGION=
|
||||
AWS_BUCKET=
|
||||
AWS_ACCESS_KEY_ID=minio
|
||||
AWS_SECRET_ACCESS_KEY=12341234
|
||||
AWS_ENDPOINT=http://localhost:9000
|
||||
AWS_REGION=local
|
||||
AWS_BUCKET=ocelot
|
||||
S3_PUBLIC_GATEWAY=http://localhost:8000
|
||||
|
||||
CATEGORIES_ACTIVE=false
|
||||
MAX_PINNED_POSTS=1
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
"cheerio": "~1.0.0",
|
||||
"cross-env": "~7.0.3",
|
||||
"dotenv": "~16.5.0",
|
||||
"email-templates": "^12.0.2",
|
||||
"email-templates": "^12.0.3",
|
||||
"express": "^5.1.0",
|
||||
"graphql": "^14.6.0",
|
||||
"graphql-middleware": "~4.0.2",
|
||||
|
||||
@ -4710,10 +4710,10 @@ electron-to-chromium@^1.5.28:
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.41.tgz#eae1ba6c49a1a61d84cf8263351d3513b2bcc534"
|
||||
integrity sha512-dfdv/2xNjX0P8Vzme4cfzHqnPm5xsZXwsolTYr0eyW18IUmNyG08vL+fttvinTfhKfIKdRoqkDIC9e9iWQCNYQ==
|
||||
|
||||
email-templates@^12.0.2:
|
||||
version "12.0.2"
|
||||
resolved "https://registry.yarnpkg.com/email-templates/-/email-templates-12.0.2.tgz#b4a3b45e0da190aa337a24d7619b464ae9d5ac06"
|
||||
integrity sha512-lCCnOgapf/h5Lqgz9XGlrkfZQW422MoHBylFvBJxq88VlALA6mt018Mp2reZvyimZ411Dyln+JKMN0Z64D6Bew==
|
||||
email-templates@^12.0.3:
|
||||
version "12.0.3"
|
||||
resolved "https://registry.yarnpkg.com/email-templates/-/email-templates-12.0.3.tgz#e35a6528460d9d3b838468d05fedde1299ad5281"
|
||||
integrity sha512-tCjkmZYakXkKfL3/qZJ7esCa04KP5zIpcuEjw9EPLQrLbTUUkX6w9MMc37zGj2nJvIpFBc1lUudHi5DkZqiNJQ==
|
||||
dependencies:
|
||||
"@ladjs/consolidate" "^1.0.4"
|
||||
"@ladjs/i18n" "^8.0.3"
|
||||
|
||||
@ -6,7 +6,7 @@ services:
|
||||
build:
|
||||
target: test
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
volumes:
|
||||
- ./coverage:/app/coverage
|
||||
|
||||
|
||||
@ -37,7 +37,23 @@ ONBUILD RUN cp -r ./locales /build
|
||||
ONBUILD RUN cp -r ./package.json ./yarn.lock /build
|
||||
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive
|
||||
|
||||
FROM build AS test
|
||||
FROM base AS test_build
|
||||
ENV NODE_ENV=test
|
||||
COPY . .
|
||||
RUN tools/merge-locales.sh
|
||||
RUN yarn install --production=false --frozen-lockfile --non-interactive
|
||||
RUN yarn run build
|
||||
RUN mkdir /build
|
||||
RUN cp -r ./.nuxt /build
|
||||
RUN cp -r ./nuxt.config.js /build
|
||||
RUN cp -r ./config/ /build
|
||||
RUN cp -r ./constants /build
|
||||
RUN cp -r ./static /build
|
||||
RUN cp -r ./locales /build
|
||||
RUN cp -r ./package.json ./yarn.lock /build
|
||||
RUN cd /build && yarn install --frozen-lockfile --non-interactive
|
||||
|
||||
FROM test_build AS test
|
||||
CMD ["/bin/bash", "-c", "yarn run dev"]
|
||||
|
||||
FROM build AS production_build
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user