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

Updated Contribution.md file #1017

Merged
merged 4 commits into from
Jan 25, 2024
Merged
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
42 changes: 16 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ This project follows [Google's Open Source Community Guidelines](https://opensou

## To start
* Fork this project on Github.
* If you do not have an Apigee Edge trial organization, create a new one
[here](https://login.apigee.com/login).
* Register on https://circleci.com using your GitHub account.
* If you do not have an Apigee Edge or X trial organization, create a new one
[here for Edge](https://login.apigee.com/login) or [X](https://apigee.google.com/).
* Setup [Github actions](https://docs.github.com/en/actions) using your GitHub account.
* Install the module from for your fork instead of Drupal.org on your local. (See below.)

## For daily work
* Create a new branch in your fork repository. It is best to name your branch something descriptive, ex.: issue-12.
* Add changes to the code. If you implement new features, add new
tests to cover the implemented functionality. If you modify existing features, update related tests.
* Push your changes to your repo's branch.
* Wait until all CircleCI test jobs finish and _pass_. (If any of them fails
restart them once or twice. They may have failed due to an API communication error. You can
* Wait until all Github Actions test jobs finish and _pass_. (If any of them fails
restart them once or twice. They may have failed due to an API communication error or caching issue. You can
identify these type of issues from logs.)
* Create [new pull request](https://github.com/apigee/apigee-edge-drupal/pull/new/8.x-1.x). CircleCI will
* Create [new pull request](https://github.com/apigee/apigee-edge-drupal/pull/new/3.x). Github Actions will
automatically report the status of each of the CI jobs directly to the GitHub PR.

## Installing module from your fork instead of Drupal.org
Expand All @@ -54,7 +54,7 @@ Update your composer.json and install the module from your fork:
```bash
cd [DRUPAL_ROOT]
composer config repositories.forked-apigee_edge vcs https://github.com/[YOUR-GITHUB-USERNAME]/apigee-edge-drupal
composer require drupal/apigee_edge:dev-issue-12 # It is important to require a branch/tag here that does not exist in the Drupal.org repo otherwise code gets pulled from there. For example, dev-8.x-1.x condition would pull the code from Drupal.org repo instead of your fork.
composer require drupal/apigee_edge:dev-issue-12 # It is important to require a branch/tag here that does not exist in the Drupal.org repo otherwise code gets pulled from there. For example, dev-3.x condition would pull the code from Drupal.org repo instead of your fork.
```

If you would like to keep your fork always up-to-date with recent changes in
Expand All @@ -72,7 +72,7 @@ upstream:
```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge
git fetch upstream
git rebase upstream/8.x-1.x
git rebase upstream/3.x
```

After you have installed the module from your fork you can easily create new
Expand All @@ -81,7 +81,7 @@ branches for new fixes on your local:
```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge
git fetch upstream
git checkout -b issue-12 upstream/8.x-1.x
git checkout -b issue-12 upstream/3.x

# Add your awesome changes.
# Do not forget to update tests or write additional test cases if needed.
Expand Down Expand Up @@ -112,7 +112,7 @@ need to be set on your system. These variables are:

Value of `APIGEE_EDGE_AUTH_TYPE` should be set to either 'basic' or 'oauth'. If you select `oauth` and have a SAML enabled org you will also need to set `APIGEE_EDGE_AUTHORIZATION_SERVER`, `APIGEE_EDGE_CLIENT_ID`, `APIGEE_EDGE_CLIENT_SECRET` values.

Value of `APIGEE_EDGE_USERNAME` should be an email address of an Apigee Edge user with **Organization administrator role** if you do not want to bump into permission issues in tests. Tests failed with "Forbidden" could be a sign of the insufficient permissions.
Value of `APIGEE_EDGE_USERNAME` should be an email address of an Apigee Edge/X user with **Organization administrator role** if you do not want to bump into permission issues in tests. Tests failed with "Forbidden" could be a sign of the insufficient permissions.

You can set these environment variables in multiple ways:
- Copy the `phpunit.core.xml.dist` file included with this module as `core/phpunit.xml`. Uncomment the `APIGEE_*`
Expand All @@ -132,6 +132,7 @@ If you wish to run tests both against a Public and a Hybrid instance:
1. First configure the credentials to the public org as described above.
2. Add the `APIGEE_EDGE_ACCOUNT_JSON_KEY` environment variable.
3. Add a`APIGEE_EDGE_HYBRID_ORGANIZATION` environment variable, which specifies the Hybrid organization to use for tests.
4. Add the `APIGEE_EDGE_HYBRID_ENDPOINT` environment variable, which specifies the Hybrid/X endpoint to use for tests.

## Install development dependencies

Expand All @@ -154,28 +155,17 @@ cd [DRUPAL_ROOT]
./vendor/bin/phpunit -c core --verbose --color modules/contrib/apigee_edge/tests/src/Kernel/EntityControllerCacheTest.php
```

If you have CircleCI CLI and Docker installed on your system you can also run
PHPUnit tests with the following commands:

```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge/
circleci local execute --job [JOB_NAME]
```

- Note: Replace `[JOB_NAME]` with the name of the job that you want to run locally. Examples:
`run-unit-kernel-tests-8`, `run-functional-tests-9`, etc.

You can read more about running Drupal 8 PHPUnit tests [here](https://www.drupal.org/docs/8/phpunit/running-phpunit-tests).
You can read more about running Drupal 9 and above PHPUnit tests [here](https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/running-phpunit-tests).

### Troubleshooting

**If a test is passing on your local, but it is failing on CircleCI:**
**If a test is passing on your local, but it is failing on Github Actions:**
1. Try to restart failing job(s) one or two times, failing tests could be caused by communication issues.
2. If (1) did not work, try to run the failing test(s) on your local with the above described CircleCI CLI.
2. If (1) did not work, try to run the failing test(s) on your local with the above described Github Actions CLI.

### If your pull request relies on changes that are not yet available in Apigee Edge Client Library for PHP's latest stable release
### If your pull request relies on changes that are not yet available in Apigee Client Library for PHP's latest stable release
You should *temporarily* add required changes as patches to module's composer.json.
This way this module's tests could pass on CircleCI.
This way this module's tests could pass on Github Actions.

#### Example:

Expand Down
Loading