mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-19 03:11:30 +00:00
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: ocelot.social end-to-end test CI
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'webapp/**'
|
|
- 'backend/**'
|
|
- 'neo4j/**'
|
|
- 'cypress/**'
|
|
- '.github/workflows/test-e2e.yml'
|
|
|
|
jobs:
|
|
build_images:
|
|
name: Build Docker Images
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- service: backend
|
|
dockerfile: backend/Dockerfile
|
|
context: backend
|
|
target: build
|
|
- service: webapp
|
|
dockerfile: webapp/Dockerfile
|
|
context: webapp
|
|
target: build
|
|
- service: neo4j
|
|
dockerfile: neo4j/Dockerfile
|
|
context: neo4j
|
|
target: community
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build ${{ matrix.service }} image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./${{ matrix.context }}
|
|
file: ./${{ matrix.dockerfile }}
|
|
target: ${{ matrix.target }}
|
|
tags: ocelotsocialnetwork/${{ matrix.service }}:test
|
|
outputs: type=docker,dest=/tmp/${{ matrix.service }}.tar
|
|
|
|
prepare_env:
|
|
name: Prepare Environment
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Setup .env and deps
|
|
run: |
|
|
cp webapp/.env.template webapp/.env || touch webapp/.env
|
|
cp backend/.env.test_e2e backend/.env || touch backend/.env
|
|
yarn --version || npm install -g yarn
|
|
mkdir -p /tmp/bin && curl -sL https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-386 -o /tmp/bin/cucumber-json-formatter
|
|
chmod +x /tmp/bin/cucumber-json-formatter
|
|
export PATH="/tmp/bin:$PATH"
|
|
yarn install || true
|
|
(cd backend && yarn install || true)
|
|
(cd webapp && yarn install || true)
|
|
|
|
fullstack_tests:
|
|
name: Run Fullstack E2E Tests
|
|
needs: [build_images, prepare_env]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
env:
|
|
jobs: 8
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Load Docker images
|
|
run: |
|
|
docker load < /tmp/neo4j.tar || true
|
|
docker load < /tmp/backend.tar || true
|
|
docker load < /tmp/webapp.tar || true
|
|
|
|
- name: Start system
|
|
run: |
|
|
docker compose -f docker-compose.yml -f docker-compose.test.yml up --build --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: Run Cypress tests
|
|
run: yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }})
|