Skip to content

Commit

Permalink
[ECP-8825] Enable pipeline runs for external contributions (#2451)
Browse files Browse the repository at this point in the history
* Add e2e flow for external contributors

* Add dispatch for debugging

* Tweak workflow name

* Tweak workflow

* Debug

* Remove draft pipeline

* Update e2e test pipeline

* Update GraphQL test pipeline

* Update Main CI workflow

* Update RestAPI test workflow

* DEBUG - Add test pipeline

* Add authorization step

* DEBUG - Test auth step

* Define an internal environment

* DEBUG - Try removing auth step and switch to conditional

* Remove trial pipeline

* Add designated worklfow for debugging

* Embed authorize step in build and add conditional

* Remove debug pipeline
  • Loading branch information
cenkiravul authored Jan 19, 2024
1 parent 2bcff1a commit da50719
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 48 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Magento 2 E2E Pipeline
run-name: Adyen Magento 2 Payment Plugin E2E tests

on:
on:
pull_request:
types: [opened, synchronize]
types: [opened, synchronize, ready_for_review]
pull_request_target:
types: [opened, synchronize, ready_for_review]

jobs:
build:
if: |
${{
github.event.pull_request.draft == false &&
(github.actor != 'renovate[bot]' || github.actor != 'lgtm-com[bot]')
}}
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
runs-on:
group: larger-runners
labels: ubuntu-latest-8-cores
Expand Down Expand Up @@ -43,15 +42,15 @@ jobs:

- name: Install plugin
run: docker exec -u www-data magento2-container make plugin

- name: Kill Cron Jobs
run: docker exec magento2-container /etc/init.d/cron stop

- name: Checkout developer module
uses: actions/checkout@v3
with:
repository: Adyen/adyen-magento2-dev
ref: 'main'
ref: "main"
token: ${{ secrets.ADYEN_AUTOMATION_BOT_TEST_ACCESS_TOKEN }}
path: Developer

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/graphql-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: GraphQL Tests
on: [pull_request]
on: [pull_request, pull_request_target]

jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
strategy:
matrix:
php-version: ["8.1"]
Expand Down
76 changes: 39 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
name: Main CI workflow

on: [pull_request]
on: [pull_request, pull_request_target]

jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
runs-on: ubuntu-latest

strategy:
matrix:
php-version: [8.1]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1

- name: Test plugin installation
run: |
echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
composer install --prefer-dist
env:
CI: true
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }}
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }}

- name: Code Sniffer
run: vendor/bin/phpcs --extensions=php,phtml --error-severity=10 --ignore-annotations

- name: Run PHPUnit
run: vendor/bin/phpunit --coverage-clover=build/clover.xml --log-junit=build/tests-log.xml -c Test/phpunit.xml Test/Unit

- name: Fix code coverage paths
run: sed -i "s;`pwd`/;;g" build/*.xml

- name: SonarCloud Scan
if: ${{ env.SONAR_TOKEN }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1

- name: Test plugin installation
run: |
echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
composer install --prefer-dist
env:
CI: true
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }}
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }}

- name: Code Sniffer
run: vendor/bin/phpcs --extensions=php,phtml --error-severity=10 --ignore-annotations

- name: Run PHPUnit
run: vendor/bin/phpunit --coverage-clover=build/clover.xml --log-junit=build/tests-log.xml -c Test/phpunit.xml Test/Unit

- name: Fix code coverage paths
run: sed -i "s;`pwd`/;;g" build/*.xml

- name: SonarCloud Scan
if: ${{ env.SONAR_TOKEN }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/restapi-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: REST API Tests
on: [pull_request]
on: [pull_request, pull_request_target]

jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
strategy:
matrix:
php-version: ["8.1"]
Expand Down

0 comments on commit da50719

Please sign in to comment.