diff --git a/.github/workflows/continous-delivery.yml b/.github/workflows/continous-delivery.yml index d5d1ea2059..6b80ff45a8 100644 --- a/.github/workflows/continous-delivery.yml +++ b/.github/workflows/continous-delivery.yml @@ -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 diff --git a/.github/workflows/fullcheck.yml b/.github/workflows/fullcheck.yml index 5f1dab4ee8..68b04d6e50 100644 --- a/.github/workflows/fullcheck.yml +++ b/.github/workflows/fullcheck.yml @@ -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 @@ -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 diff --git a/.github/workflows/run-and-record-cypress.yml b/.github/workflows/run-and-record-cypress.yml new file mode 100644 index 0000000000..e40cd1a4b5 --- /dev/null +++ b/.github/workflows/run-and-record-cypress.yml @@ -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 }} diff --git a/cypress/package.json b/cypress/package.json index 1968170281..6480cce189 100644 --- a/cypress/package.json +++ b/cypress/package.json @@ -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",