mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-18 19:01:29 +00:00
e2
This commit is contained in:
parent
32223d1505
commit
e1967959bd
109
.github/workflows/test-e2e.yml
vendored
109
.github/workflows/test-e2e.yml
vendored
@ -60,18 +60,18 @@ jobs:
|
||||
cd backend
|
||||
yarn install
|
||||
yarn build
|
||||
- name: Cache backend node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: backend/node_modules
|
||||
key: node-modules-${{ runner.os }}-${{ hashFiles('backend/yarn.lock') }}
|
||||
restore-keys: |
|
||||
node-modules-${{ runner.os }}-
|
||||
- name: Upload backend build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: backend-build
|
||||
path: backend/build
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
backend/node_modules
|
||||
webapp/node_modules
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
prepare_webapp:
|
||||
name: Prepare webapp
|
||||
@ -85,19 +85,19 @@ jobs:
|
||||
run: |
|
||||
cp webapp/.env.template webapp/.env || touch webapp/.env
|
||||
(cd webapp && yarn install || true)
|
||||
- name: Cache node_modules
|
||||
- name: Cache webapp node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
backend/node_modules
|
||||
webapp/node_modules
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
path: webapp/node_modules
|
||||
key: node-modules-${{ runner.os }}-${{ hashFiles('webapp/yarn.lock') }}
|
||||
restore-keys: |
|
||||
node-modules-${{ runner.os }}-
|
||||
|
||||
prepare_cypress:
|
||||
name: Prepare Cypress
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
- name: Copy env files
|
||||
run: |
|
||||
cp webapp/.env.template webapp/.env
|
||||
@ -106,12 +106,9 @@ jobs:
|
||||
run: |
|
||||
wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-386"
|
||||
chmod +x /opt/cucumber-json-formatter
|
||||
cd backend
|
||||
cd backend && yarn install && yarn build && cd ..
|
||||
yarn install
|
||||
yarn build
|
||||
cd ..
|
||||
yarn install
|
||||
- name: Cache cypress, node_modules and project
|
||||
- name: Cache cypress and dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
@ -119,8 +116,7 @@ jobs:
|
||||
~/.cache/Cypress
|
||||
node_modules
|
||||
backend/node_modules
|
||||
/home/runner/work/Ocelot-Social/Ocelot-Social
|
||||
key: ${{ github.run_id }}-e2e-cypress
|
||||
key: cypress-cache-${{ github.run_id }}
|
||||
|
||||
fullstack_tests:
|
||||
name: Run Fullstack E2E Tests
|
||||
@ -130,22 +126,43 @@ jobs:
|
||||
jobs: 8
|
||||
strategy:
|
||||
matrix:
|
||||
job: [1,2,3,4,5,6,7,8]
|
||||
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
steps:
|
||||
- name: Restore cypress and project cache
|
||||
- name: Restore node_modules cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
backend/node_modules
|
||||
/home/runner/work/Ocelot-Social/Ocelot-Social
|
||||
key: ${{ github.run_id }}-e2e-cypress
|
||||
|
||||
webapp/node_modules
|
||||
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
node-modules-${{ runner.os }}-
|
||||
- name: Download Docker image tarballs
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-image
|
||||
path: /tmp
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webapp-image
|
||||
path: /tmp
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: neo4j-image
|
||||
path: /tmp
|
||||
- name: Load Docker images
|
||||
run: |
|
||||
docker load < /tmp/neo4j.tar
|
||||
docker load < /tmp/backend.tar
|
||||
docker load < /tmp/webapp.tar
|
||||
- name: Download backend build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-build
|
||||
path: backend/build
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Add node_modules/.bin to PATH
|
||||
run: echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Ensure Cypress CLI is available
|
||||
run: |
|
||||
if ! command -v cypress >/dev/null; then
|
||||
@ -154,51 +171,17 @@ jobs:
|
||||
else
|
||||
echo "✅ Cypress CLI is present"
|
||||
fi
|
||||
|
||||
- name: Setup .env files
|
||||
run: |
|
||||
mkdir -p webapp backend
|
||||
cp webapp/.env.template webapp/.env || touch webapp/.env
|
||||
cp backend/.env.test_e2e backend/.env || touch backend/.env
|
||||
|
||||
- name: Download neo4j image tarball
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: neo4j-image
|
||||
path: /tmp
|
||||
|
||||
- name: Download backend image tarball
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-image
|
||||
path: /tmp
|
||||
|
||||
- name: Download webapp image tarball
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webapp-image
|
||||
path: /tmp
|
||||
|
||||
- name: Load Docker images
|
||||
run: |
|
||||
docker load < /tmp/neo4j.tar
|
||||
docker load < /tmp/backend.tar
|
||||
docker load < /tmp/webapp.tar
|
||||
|
||||
- name: Start system
|
||||
run: |
|
||||
set -e
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach webapp mailserver
|
||||
- name: Wait for webapp
|
||||
|
||||
run: |
|
||||
for i in {1..30}; do curl -sf http://localhost:3000 && exit 0 || sleep 2; done; exit 1
|
||||
|
||||
- name: Download backend build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-build
|
||||
path: backend/build
|
||||
|
||||
- name: Run Cypress tests
|
||||
run: yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }})
|
||||
Loading…
x
Reference in New Issue
Block a user