-
Notifications
You must be signed in to change notification settings - Fork 146
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
chore: run e2e tests on demand #441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is huge!
Just left some minor suggestions to reword part of the contributing section + added a disclaimer about potential costs of running the tests.
Only other note is that the unit tests in logger are not yet tagged so even when running test:e2e the regular unit ones are running. Done in e3a83ce
thx for the commit ! |
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work @flochaz! Looking forward to merge this one, but I left a few comments in this PR that I think should be discussed before merging it.
Also I think I need a better understanding of what will be included in the upcoming PR's related to the same ticket, always in the spirit of maintaining the PRs size small.
CONTRIBUTING.md
Outdated
* `AWS_PROFILE` to use the right credentials | ||
* `DISABLE_TEARDOWN` if you don't want your stack to be destroyed at the end of the test (useful in dev mode when iterating over your code). | ||
|
||
Example: `DISABLE_TEARDOWN=true AWS_PROFILE=ara npx jest --group=integ/other/example` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: can we add a real example?
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
f90ba87
to
64304ce
Compare
3151afc
to
4f62c1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
CONTRIBUTING.md
Outdated
1. Create an IAM role in your target AWS account, with the least amount of privilege. | ||
|
||
As mentioned above in this page, we are leveraging CDK to deploy and consequently clean-up resources on AWS. Therefore to run those tests through Github actions you will need to grant specific permissions to your workflow. | ||
|
||
We recommend following [Amazon IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) for the AWS credentials used in GitHub Actions workflows, including: | ||
* Do not store credentials in your repository's code. | ||
* [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege) to the credentials used in GitHub Actions workflows. Grant only the permissions required to perform the actions in your GitHub Actions workflows. | ||
* [Monitor the activity](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#keep-a-log) of the credentials used in GitHub Actions workflows. | ||
|
||
For an example of how to create a role in CDK, you can look at [@pahud/cdk-github-oidc](https://constructs.dev/packages/@pahud/cdk-github-oidc) construct. | ||
|
||
More information about: | ||
|
||
- [Github OpenID Connect](https://github.blog/changelog/2021-10-27-github-actions-secure-cloud-deployments-with-openid-connect/ | ||
- ["Configure AWS Credentials" Action For GitHub Actions](https://github.com/aws-actions/configure-aws-credentials/) | ||
1. Add your new role into your [Github fork secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) with name `AWS_ROLE_ARN_TO_ASSUME`. | ||
1. In your forked repository, go to the "Actions" tabs, select the `run-e2e-tests` workflow. | ||
1. In the run-e2e-tests workflow page, select "Run workflow" and run it on the desired branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: steps numbers are all "1."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They rendered correctly by GitHub preview & according to spec it's not required for them to be in order:
To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.
But for those who are reading the source I agree that it was confusing, changed it in 973a9d5.
@@ -11,7 +11,8 @@ | |||
}, | |||
"scripts": { | |||
"commit": "commit", | |||
"test": "jest --detectOpenHandles --coverage --verbose", | |||
"test": "npm run test:unit", | |||
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of your changes
Running e2e tests on demand.
Next we will need to make sure that some following PRs handle decision made in discussion #315 .
Potential improvment
Run only when module changes with
--onlyChanged --changedSince=main
option on jestHow to verify this change
Check for https://github.com/awslabs/aws-lambda-powertools-typescript/actions/workflows/run-e2e-tests.yml tests run
Related issues, RFCs
#418
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.