Skip to content

Commit

Permalink
TO REMOVE: comment out E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tconte-pass committed Feb 7, 2025
1 parent 852dcbe commit 6d0a81a
Showing 1 changed file with 165 additions and 165 deletions.
330 changes: 165 additions & 165 deletions .github/workflows/dev_on_workflow_tests_pro_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,171 +32,171 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.2.2
- uses: technote-space/workflow-conclusion-action@v3
- name: "Authentification to Google"
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
- name: "Get Secret"
id: secrets
uses: "google-github-actions/get-secretmanager-secrets@v2"
with:
secrets: |-
SLACK_BOT_TOKEN:passculture-metier-ehp/passculture-ci-slack-bot-token
ARTIFACT_REGISTRY_WORKLOAD_IDENTITY_PROVIDER:passculture-metier-ehp/infra-prod-gcp-workload-identity-provider
ARTIFACT_REGISTRY_SERVICE_ACCOUNT:passculture-metier-ehp/passculture-main-artifact-registry-service-account
CYPRESS_CLOUD_RECORD_KEY:passculture-metier-ehp/e2e-tests-pro-cypress-cloud-record-key
CYPRESS_CLOUD_PROJECT_ID:passculture-metier-ehp/e2e-tests-pro-cypress-cloud-project-id
- name: "OpenID Connect Authentication"
id: openid-auth
uses: "google-github-actions/auth@v2"
with:
create_credentials_file: false
token_format: "access_token"
workload_identity_provider: ${{ steps.secrets.outputs.ARTIFACT_REGISTRY_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ steps.secrets.outputs.ARTIFACT_REGISTRY_SERVICE_ACCOUNT }}
- name: "Docker login"
id: docker-login
uses: "docker/login-action@v3"
with:
registry: "europe-west1-docker.pkg.dev"
username: "oauth2accesstoken"
password: "${{ steps.openid-auth.outputs.access_token }}"
- name: "Compute docker image name:tag"
id: compute-image-name
run: |
echo "image_name=${{ env.registry }}/${{ inputs.image }}:${{ inputs.tag }}" | tee -a ${GITHUB_OUTPUT}
echo "::notice:: Running e2e-tests with ${{ env.registry }}/${{ inputs.image }}:${{ inputs.tag }}"
- name: "Download artifact"
if: ${{ inputs.tag != 'latest' }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.image }}-${{ inputs.tag }}.tar
path: ${{ runner.temp }}
- uses: actions/setup-node@v4
with:
node-version-file: "pro/.nvmrc"
- uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: "2.23.3"
- name: "Fix local permissions"
run: sudo chown -R $PCAPI_UID:$PCAPI_GID .
working-directory: api
env:
PCAPI_UID: 1000
PCAPI_GID: 1000
- name: "Cache the node_modules"
id: "yarn-modules-cache"
uses: pass-culture-github-actions/cache@v1.0.0
with:
compression-method: "gzip"
bucket: ${{ inputs.CACHE_BUCKET_NAME }}
path: |
~/.cache/Cypress
**/node_modules
key: v1-yarn-pro-cypress-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v1-yarn-pro-cypress-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --immutable
- name: "Run postgres and redis server"
run: docker-compose -f ../docker-compose-backend.yml up postgres redis -d
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
- name: "Run API server"
run: |
if [ "${{ inputs.tag }}" != "latest" ]; then
docker load --input ${{ runner.temp }}/${{ inputs.image }}-${{ inputs.tag }}.tar
fi
docker run \
--name pc-api \
--workdir /usr/src/app \
--volume ./../api:/usr/src/app \
--env-file ./../env_file \
--tty \
--detach \
--network pass-culture-main_db_nw \
--restart on-failure \
--publish 5001:5001 \
--publish 10002:10002 \
--entrypoint bash \
${{ steps.compute-image-name.outputs.image_name }} \
-c "set -e ; flask install_postgres_extensions ; alembic upgrade pre@head ; alembic upgrade post@head ; flask install_data ; python src/pcapi/app.py"
- name: "Wait for migrations to be run"
uses: iFaxity/wait-on-action@v1
with:
resource: http://localhost:5001/health/api
timeout: 120000
- name: "Build vite application"
run: yarn build:development
- name: "Serve vite preview"
run: yarn serve &
# Using wait-on does not work well for this service, we use curl
- name: "Wait for front-end to listen"
run: |
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:3001)" != "200" ]]; do sleep 5; done' || false
# Doc : https://github.com/cypress-io/github-action
- name: "Cypress run"
uses: cypress-io/github-action@v6
with:
wait-on: "http://localhost:5001/health/api,http://localhost:5001/health/database"
wait-on-timeout: 600
working-directory: pro
browser: chrome
config-file: cypress/cypress.config.ts
env: TAGS="@P0"
record: ${{ github.ref == 'refs/heads/master' }} # for Cypress Cloud
spec: "cypress/e2e/*"
env:
CYPRESS_RECORD_KEY: ${{ steps.secrets.outputs.CYPRESS_CLOUD_RECORD_KEY }}
CYPRESS_PROJECT_ID: ${{ steps.secrets.outputs.CYPRESS_CLOUD_PROJECT_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - uses: technote-space/workflow-conclusion-action@v3
# - name: "Authentification to Google"
# uses: "google-github-actions/auth@v2"
# with:
# workload_identity_provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
# service_account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
# - name: "Get Secret"
# id: secrets
# uses: "google-github-actions/get-secretmanager-secrets@v2"
# with:
# secrets: |-
# SLACK_BOT_TOKEN:passculture-metier-ehp/passculture-ci-slack-bot-token
# ARTIFACT_REGISTRY_WORKLOAD_IDENTITY_PROVIDER:passculture-metier-ehp/infra-prod-gcp-workload-identity-provider
# ARTIFACT_REGISTRY_SERVICE_ACCOUNT:passculture-metier-ehp/passculture-main-artifact-registry-service-account
# CYPRESS_CLOUD_RECORD_KEY:passculture-metier-ehp/e2e-tests-pro-cypress-cloud-record-key
# CYPRESS_CLOUD_PROJECT_ID:passculture-metier-ehp/e2e-tests-pro-cypress-cloud-project-id
# - name: "OpenID Connect Authentication"
# id: openid-auth
# uses: "google-github-actions/auth@v2"
# with:
# create_credentials_file: false
# token_format: "access_token"
# workload_identity_provider: ${{ steps.secrets.outputs.ARTIFACT_REGISTRY_WORKLOAD_IDENTITY_PROVIDER }}
# service_account: ${{ steps.secrets.outputs.ARTIFACT_REGISTRY_SERVICE_ACCOUNT }}
# - name: "Docker login"
# id: docker-login
# uses: "docker/login-action@v3"
# with:
# registry: "europe-west1-docker.pkg.dev"
# username: "oauth2accesstoken"
# password: "${{ steps.openid-auth.outputs.access_token }}"
# - name: "Compute docker image name:tag"
# id: compute-image-name
# run: |
# echo "image_name=${{ env.registry }}/${{ inputs.image }}:${{ inputs.tag }}" | tee -a ${GITHUB_OUTPUT}
# echo "::notice:: Running e2e-tests with ${{ env.registry }}/${{ inputs.image }}:${{ inputs.tag }}"
# - name: "Download artifact"
# if: ${{ inputs.tag != 'latest' }}
# uses: actions/download-artifact@v4
# with:
# name: ${{ inputs.image }}-${{ inputs.tag }}.tar
# path: ${{ runner.temp }}
# - uses: actions/setup-node@v4
# with:
# node-version-file: "pro/.nvmrc"
# - uses: KengoTODA/actions-setup-docker-compose@v1
# with:
# version: "2.23.3"
# - name: "Fix local permissions"
# run: sudo chown -R $PCAPI_UID:$PCAPI_GID .
# working-directory: api
# env:
# PCAPI_UID: 1000
# PCAPI_GID: 1000
# - name: "Cache the node_modules"
# id: "yarn-modules-cache"
# uses: pass-culture-github-actions/cache@v1.0.0
# with:
# compression-method: "gzip"
# bucket: ${{ inputs.CACHE_BUCKET_NAME }}
# path: |
# ~/.cache/Cypress
# **/node_modules
# key: v1-yarn-pro-cypress-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# v1-yarn-pro-cypress-dependency-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
# - run: yarn install --immutable
# - name: "Run postgres and redis server"
# run: docker-compose -f ../docker-compose-backend.yml up postgres redis -d
# - name: "Set up Cloud SDK"
# uses: "google-github-actions/setup-gcloud@v2"
# - name: "Run API server"
# run: |
# if [ "${{ inputs.tag }}" != "latest" ]; then
# docker load --input ${{ runner.temp }}/${{ inputs.image }}-${{ inputs.tag }}.tar
# fi
# docker run \
# --name pc-api \
# --workdir /usr/src/app \
# --volume ./../api:/usr/src/app \
# --env-file ./../env_file \
# --tty \
# --detach \
# --network pass-culture-main_db_nw \
# --restart on-failure \
# --publish 5001:5001 \
# --publish 10002:10002 \
# --entrypoint bash \
# ${{ steps.compute-image-name.outputs.image_name }} \
# -c "set -e ; flask install_postgres_extensions ; alembic upgrade pre@head ; alembic upgrade post@head ; flask install_data ; python src/pcapi/app.py"
# - name: "Wait for migrations to be run"
# uses: iFaxity/wait-on-action@v1
# with:
# resource: http://localhost:5001/health/api
# timeout: 120000
# - name: "Build vite application"
# run: yarn build:development
# - name: "Serve vite preview"
# run: yarn serve &
# # Using wait-on does not work well for this service, we use curl
# - name: "Wait for front-end to listen"
# run: |
# timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:3001)" != "200" ]]; do sleep 5; done' || false
# # Doc : https://github.com/cypress-io/github-action
# - name: "Cypress run"
# uses: cypress-io/github-action@v6
# with:
# wait-on: "http://localhost:5001/health/api,http://localhost:5001/health/database"
# wait-on-timeout: 600
# working-directory: pro
# browser: chrome
# config-file: cypress/cypress.config.ts
# env: TAGS="@P0"
# record: ${{ github.ref == 'refs/heads/master' }} # for Cypress Cloud
# spec: "cypress/e2e/*"
# env:
# CYPRESS_RECORD_KEY: ${{ steps.secrets.outputs.CYPRESS_CLOUD_RECORD_KEY }}
# CYPRESS_PROJECT_ID: ${{ steps.secrets.outputs.CYPRESS_CLOUD_PROJECT_ID }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: "Remove Cypress videos from Allure results"
# run: rm -rf ../allure-results/*.mp4
# # - name: "Remove Cypress videos from Allure results"
# # run: rm -rf ../allure-results/*.mp4

# - name: "Upload Allure results for pro E2E tests"
# uses: actions/upload-artifact@v4
# with:
# name: allure-results-pro-e2e
# path: allure-results
# # - name: "Upload Allure results for pro E2E tests"
# # uses: actions/upload-artifact@v4
# # with:
# # name: allure-results-pro-e2e
# # path: allure-results

- name: "Move cypress videos"
if: always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
run: |
mkdir -p cypress/videos/${{ github.ref }}/${{ github.sha }} && \
mv cypress/videos/*.mp4 cypress/videos/${{ github.ref }}/${{ github.sha }}/
- name: "Archive E2E results"
if: always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
uses: google-github-actions/upload-cloud-storage@v2
with:
path: "pro/cypress/videos"
destination: "${{ inputs.CACHE_BUCKET_NAME }}/pro/cypress/videos/e2e-artifacts"
- name: "Show pcapi log when it fails"
if: failure()
run: docker logs pc-api
- name: "Post to a Slack channel"
if: always() && failure() && github.ref == 'refs/heads/master'
uses: slackapi/slack-github-action@v1.27.0
with:
# channel #dev
channel-id: "CPZ7U1CNP"
payload: |
{
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "#A30002",
"author_name": "${{github.actor}}",
"author_link": "https://github.com/${{github.actor}}",
"author_icon": "https://github.com/${{github.actor}}.png",
"title": "Tests pro E2E",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"text": "Les tests pro E2E échouent sur `master` :boom:"
}
],
"unfurl_links": false,
"unfurl_media": false
}
env:
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
# - name: "Move cypress videos"
# if: always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
# run: |
# mkdir -p cypress/videos/${{ github.ref }}/${{ github.sha }} && \
# mv cypress/videos/*.mp4 cypress/videos/${{ github.ref }}/${{ github.sha }}/
# - name: "Archive E2E results"
# if: always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
# uses: google-github-actions/upload-cloud-storage@v2
# with:
# path: "pro/cypress/videos"
# destination: "${{ inputs.CACHE_BUCKET_NAME }}/pro/cypress/videos/e2e-artifacts"
# - name: "Show pcapi log when it fails"
# if: failure()
# run: docker logs pc-api
# - name: "Post to a Slack channel"
# if: always() && failure() && github.ref == 'refs/heads/master'
# uses: slackapi/slack-github-action@v1.27.0
# with:
# # channel #dev
# channel-id: "CPZ7U1CNP"
# payload: |
# {
# "attachments": [
# {
# "mrkdwn_in": ["text"],
# "color": "#A30002",
# "author_name": "${{github.actor}}",
# "author_link": "https://github.com/${{github.actor}}",
# "author_icon": "https://github.com/${{github.actor}}.png",
# "title": "Tests pro E2E",
# "title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
# "text": "Les tests pro E2E échouent sur `master` :boom:"
# }
# ],
# "unfurl_links": false,
# "unfurl_media": false
# }
# env:
# SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}

0 comments on commit 6d0a81a

Please sign in to comment.