Skip to content

Commit

Permalink
feat: updating github action test to launch elk
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianRid committed Dec 2, 2024
1 parent b256ae2 commit 6247810
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ jobs:
ports:
- 8025:8025
- 1025:1025
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.12.1
env:
- discovery.type: single-node
- xpack.security.enabled: true
- ES_JAVA_OPTS: -Xms512m -Xmx512m
- ELASTIC_PASSWORD: ${{ secrets.ES_ADDON_PASSWORD }}
ports:
- 9200:9200
options: >-
--health-cmd="curl -s --insecure https://localhost:9200/_cluster/health || exit 1"
--health-interval=30s
--health-timeout=10s
--health-retries=5
steps:
# 1. Checkout du code
Expand All @@ -46,36 +60,42 @@ jobs:
webapp-backoffice/yarn.lock
webapp-form/yarn.lock
# 4. Installer les dépendances et générer le client Prisma pour `webapp-backoffice`
#4 Configurer l'environnement ElasticSearch
- name: Configure Elasticsearch environment
run: |
echo "ES_ADDON_URI=${{ secrets.ES_ADDON_URI }}" >> webapp-backoffice/.env
echo "ES_ADDON_USER=${{ secrets.ES_ADDON_USER }}" >> webapp-backoffice/.env
echo "ES_ADDON_PASSWORD=${{ secrets.ES_ADDON_PASSWORD }}" >> webapp-backoffice/.env
# 5. Installer les dépendances et générer le client Prisma pour `webapp-backoffice`
- name: Install dependencies and generate Prisma client for webapp-backoffice
run: |
cd webapp-backoffice
yarn install
npx prisma generate
npx prisma migrate reset --force
# 5. Installer les dépendances et générer le client Prisma pour `webapp-form`
# 6. Installer les dépendances et générer le client Prisma pour `webapp-form`
- name: Install dependencies and generate Prisma client for webapp-form
run: |
cd webapp-form
yarn install
npx prisma generate
# 6. Construire `webapp-backoffice`
# 7. Construire `webapp-backoffice`
- name: Build webapp-backoffice
run: |
cd webapp-backoffice
yarn build
nohup yarn start &
# 7. Construire `webapp-form`
# 8. Construire `webapp-form`
- name: Build webapp-form
run: |
cd webapp-form
yarn build
nohup yarn startB &
# 8. Attendre que les services soient prêts
# 9. Attendre que les services soient prêts
- name: Wait for services to be ready
run: |
echo "Waiting for webapp-backoffice to be ready..."
Expand All @@ -87,16 +107,19 @@ jobs:
echo "Waiting for MailHog to be ready..."
until curl -s http://localhost:8025 > /dev/null; do echo "Waiting for MailHog..."; sleep 5; done
# 9. Exécuter les tests Cypress pour `webapp-backoffice`
echo "Waiting for Elasticsearch to be ready..."
until curl -s --insecure https://localhost:9200/_cluster/health > /dev/null; do echo "Waiting for Elasticsearch..."; sleep 5; done
# 10. Exécuter les tests Cypress pour `webapp-backoffice`
- name: Run Cypress tests for webapp-backoffice
working-directory: ./webapp-backoffice
run: npx cypress run --spec "cypress/e2e/jdma/launcher.cy.js" --headed --browser chrome

# 10. Vérifier si MailHog reçoit les emails
# 11. Vérifier si MailHog reçoit les emails
- name: Check MailHog for received emails
run: curl http://localhost:8025/api/v2/messages

# 11. Arrêter les applications démarrées
# 12. Arrêter les applications démarrées
- name: Stop applications
run: |
pkill -f "yarn start" || true
Expand Down

0 comments on commit 6247810

Please sign in to comment.