Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature / Cypress in GH actions #303

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-back-artefact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-front-artefact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
Expand Down
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
49 changes: 49 additions & 0 deletions .github/workflows/cypress-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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: Send Discord notification
run: |
curl -X POST -H "Content-Type: application/json" -d '{
"content": "Les tests Cypress sont lancés, le report est dispo sur : https://cloud.cypress.io/projects/vctxdm/runs",
}' ${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Cypress run
continue-on-error: true
run: |
pnpm cypress run-e2e \
--key ${{ secrets.CYPRESS_RECORD_KEY }} \
--tag "dev,${{ inputs.tag }}" \
--parallel \
--ci-build-id ${{ inputs.tag }} \
--browser chrome \
--headless \
--quiet \
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-e2e": "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