Add editor config and sonarcloud config #631
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: E2E Test | |
on: | |
pull_request: | |
branches: ["main", "develop"] | |
types: ["opened", "synchronize", "reopened", "ready_for_review"] | |
workflow_dispatch: | |
jobs: | |
launch: | |
strategy: | |
matrix: | |
version: | |
- 8.2.2 | |
runs-on: ubuntu-22.04 | |
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'hotfix') | |
steps: | |
- name: Generate Github token for PR checks | |
id: github-token-checks | |
uses: actions/create-github-app-token@v1 | |
continue-on-error: true | |
with: | |
app-id: ${{ secrets.ALMA_UPDATE_CHECKS_APP_ID }} | |
private-key: ${{ secrets.ALMA_UPDATE_CHECKS_APP_PEM }} | |
repositories: alma-woocommerce-gateway | |
- name: Create a Github check for E2E tests run in the Pull Request | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
id: create-github-check | |
with: | |
github-token: ${{ steps.github-token-checks.outputs.token }} | |
script: | | |
const check = await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'E2E tests results', | |
head_sha: '${{ github.event.pull_request.head.sha }}', | |
status: "in_progress", | |
}) | |
core.setOutput('id', check.data.id) | |
- name: Generate Github token for integration-infrastructure repo | |
id: github-token-infrastructure | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.ALMA_WF_TRIGGER_APP_ID }} | |
private-key: ${{ secrets.ALMA_WF_TRIGGER_APP_PEM }} | |
repositories: integration-infrastructure | |
- name: Trigger E2E tests in the integration-infrastructure repository | |
uses: codex-/return-dispatch@v1 | |
id: e2e-tests-workflow-dispatch | |
with: | |
token: ${{ steps.github-token-infrastructure.outputs.token }} | |
ref: main | |
repo: integration-infrastructure | |
owner: alma | |
workflow: deploy-cms.yaml | |
workflow_inputs: '{ | |
"name": "e2e-${{ github.run_id }}", | |
"alma_plugin_branch": "${{ github.head_ref || github.ref_name }}", | |
"alma_plugin_test_branch" : "main", | |
"cms": "woocommerce-${{ matrix.version }}", | |
"e2e": "true", | |
"e2e_check_info" : "{ | |
\"repository\": \"${{ github.event.repository.name }}\", | |
\"pr_number\": \"${{ github.event.number }}\", | |
\"check_id\": \"${{ steps.create-github-check.outputs.id }}\" | |
}" | |
}' | |
workflow_timeout_seconds: 120 # Default: 300 | |
- name: Hide deprecated E2E test run info message | |
uses: int128/hide-comment-action@v1 | |
with: | |
# This string should be kept in sync with the last words of the comment in. | |
# `Send a comment to the PR informing that the E2E tests are running` step (in this workflow). | |
# `Add a comment with E2E tests results in the Pull Request` step (in e2e-test-post-results workflow) | |
contains: <!-- id:e2e-test-run-info --> | |
- name: Send a comment to the PR informing that the E2E tests are running | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '⏳E2E tests are currently running. \n' + | |
'➡️ You can follow their progression [here](${{steps.e2e-tests-workflow-dispatch.outputs.run_url}}).' + | |
'\n\n<!-- id:e2e-test-run-info -->' | |
}) | |
- name: Update Github check with the E2E tests run URL | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ steps.github-token-checks.outputs.token }} | |
script: | | |
const checkOutput = { | |
title: 'E2E tests results', | |
summary: '⏳E2E tests are currently running.', | |
text: '➡️ You can follow their progression [here](${{steps.e2e-tests-workflow-dispatch.outputs.run_url}}).' | |
}; | |
github.rest.checks.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
check_run_id: '${{ steps.create-github-check.outputs.id }}', | |
output: checkOutput | |
}) | |