Skip to content

Commit

Permalink
added cypress workflow, renamed run command
Browse files Browse the repository at this point in the history
  • Loading branch information
enguerranws committed Jun 14, 2023
1 parent 625fc02 commit 7dce732
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 42 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/continous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ jobs:
SCALINGO_API_TOKEN: ${{ secrets.SCALINGO_API_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

run-cypress-on-dev:
name: Run Cypress on dev
needs: deploy-dev
uses: ./.github/workflows/run-and-record-cypress.yml
with:
environment: dev
tag: "v${{ github.run_number }}"
secrets:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

deploy-staging:
name: Deploy staging
needs: deploy-dev
Expand Down
50 changes: 10 additions & 40 deletions .github/workflows/fullcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ on:
workflow_call:

jobs:
run-cypress-on-dev:
name: Run Cypress on dev
uses: ./.github/workflows/run-and-record-cypress.yml
with:
environment: dev
tag: "v${{ github.run_number }}"
secrets:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

validation:
name: ""
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,43 +49,3 @@ jobs:
STORAGE_FULL_PATH=$(pwd)/back/storage
mkdir -p $STORAGE_FULL_PATH/tmp/
STORAGE_ROOT=$STORAGE_FULL_PATH $COMMAND
back-integration-tests:
name: "Back integration tests"
runs-on: ubuntu-latest
env:
TEST_DATABASE_URL: postgresql://immersion:password@localhost:5432/immersion-db
services:
postgres:
image: postgis/postgis:13-master
env:
POSTGRES_USER: immersion
POSTGRES_PASSWORD: password
POSTGRES_DB: immersion-db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run migrations
run: NODE_ENV=test DATABASE_URL=$TEST_DATABASE_URL pnpm back migrate up
- name: Run integration tests
run: |
echo $TEST_DATABASE_URL
STORAGE_FULL_PATH=$(pwd)/back/storage
mkdir -p $STORAGE_FULL_PATH/tmp/
DATABASE_URL=$TEST_DATABASE_URL STORAGE_ROOT=$STORAGE_FULL_PATH pnpm back test:integration
43 changes: 43 additions & 0 deletions .github/workflows/run-and-record-cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run Cypress on dev
on:
workflow_call:
secrets:
CYPRESS_RECORD_KEY:
required: true
DISCORD_WEBHOOK_URL:
required: true
inputs:
tag:
type: string
required: true
environment:
type: string
required: true
jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Echo
run: echo "Running Cypress on dev"
- name: Checkout
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/github-action@v5
with:
record: true
browser: chrome
headless: true
parallel: true
quiet: true
tag: "dev,${{ inputs.tag }}"
ci-build-id: ${{ inputs.tag }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Send Discord notification
run: |
curl -X POST -H "Content-Type: application/json" -d '{
"content": "Les tests Cypress sont terminés, le report est dispo sur : https://cloud.cypress.io/projects/vctxdm/runs",
}' ${{ secrets.DISCORD_WEBHOOK_URL }}
3 changes: 1 addition & 2 deletions cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"scripts": {
"open": "CYPRESS_BASE_URL=http://localhost:3000/ CYPRESS_ADMIN_USER=admin CYPRESS_ADMIN_PASSWORD=password node_modules/.bin/cypress open",
"install": "CYPRESS_ADMIN_USER=admin CYPRESS_ADMIN_PASSWORD=password node_modules/.bin/cypress install",
"run-cloud": "CYPRESS_ADMIN_USER=admin CYPRESS_ADMIN_PASSWORD=password node_modules/.bin/cypress run --record",
"open-dev-scalingo": "CYPRESS_BASE_URL=https://dev.immersion-facile.beta.gouv.fr/ CYPRESS_ADMIN_USER=admin CYPRESS_ADMIN_PASSWORD=admin node_modules/.bin/cypress open"
"run-cloud": "CYPRESS_BASE_URL=https://dev.immersion-facile.beta.gouv.fr/ CYPRESS_ADMIN_USER=admin CYPRESS_ADMIN_PASSWORD=admin node_modules/.bin/cypress run --record"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
Expand Down

0 comments on commit 7dce732

Please sign in to comment.