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

ci(repo): New CI pipeline #2331

Merged
merged 16 commits into from
Nov 16, 2022
Merged

ci(repo): New CI pipeline #2331

merged 16 commits into from
Nov 16, 2022

Conversation

dnys1
Copy link
Contributor

@dnys1 dnys1 commented Nov 8, 2022

  • Removes mono_repo dependency throughout
  • Adds custom workflows for Dart+Flutter packages
  • Adds aft generate workflows command for automatically generating workflows

@dnys1 dnys1 requested a review from a team as a code owner November 8, 2022 23:41
@dnys1 dnys1 force-pushed the feat/new-ci branch 5 times, most recently from 7b7d251 to a59f95f Compare November 9, 2022 00:38
Comment on lines +10 to +14
- `generate`: Generates various repo items
- `workflows`: Generates GitHub actions workflows for all packages in the repo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdk should be listed under generate, right?

Suggested change
- `generate`: Generates various repo items
- `workflows`: Generates GitHub actions workflows for all packages in the repo
- `generate`: Generates various repo items
- `workflows`: Generates GitHub actions workflows for all packages in the repo
- `sdk`: Generates the AWS SDK for a given package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked the sdk command as hidden for right now. It only works for me.

Comment on lines +143 to +125
/// Skip package checks for Flutter packages when running in CI without
/// Flutter, which may happen when testing Dart-only packages or specific
/// Dart versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I follow this. Would this be a dart-only package that has flutter listed as a dependency for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a roundabout way of saying "don't try to run flutter pub upgrade when flutter is not available"

import 'package:aft/aft.dart';
import 'package:path/path.dart' as p;

/// Command for generating associated items in the repo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment

/// The package's pubspec.
final PubspecInfo pubspecInfo;

/// The package flavor, e.g. Dart or Flutter.
final PackageFlavor flavor;

/// The integration test directory within the enclosing directory, if any
Directory? get integTestDirectory {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used currently, correct? Are you workflows for integ tests could be generated as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not currently used. Needed for aft test though. I can remove it here.

@dnys1 dnys1 force-pushed the feat/new-ci branch 3 times, most recently from 2547004 to 38eef64 Compare November 10, 2022 18:59
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # 3.1.0

- name: Setup Flutter
uses: subosito/flutter-action@dbf1fa04f4d2e52c33185153d06cdb5443aa189d # 2.7.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uber nit: isn't this 2.8.0 subosito/flutter-action@dbf1fa0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Updated 👍

Copy link
Contributor

@ragingsquirrel3 ragingsquirrel3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved w some small nit/questions/callouts that are non-blocking.

One general question: When would it make sense to remove the tests from circle that are redundant here? Specifically thinking of flutter unit tests. I know you mentioned it's on the roadmap to remove circle runners when Dart impls finished but dk if we want to specifically remove the same tests being run in 2 places.

- next
pull_request:
paths:
- 'packages/amplify_datastore/**/*.dart'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Would it make sense to also include interface paths to this pattern so that changes to the interface execute these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the future this will be possible to do, specifically when #2068 is merged since it has the semantic understanding of the repo (which packages depend on which).

- next
pull_request:
paths:
- 'packages/api/amplify_api/**/*.dart'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is the reason for having the category flutter vm tests all be their own workflow that is seems difficult to enforce this pr/pattern thing any other way? Absent that, seems like a matrix would work nicely but not sure how you would do this via matrix. Seems to make sense, just trying to make sure I understand why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the question. Each package gets its own workflow. Which workflows run depends on the structure of the package. The flutter_vm workflow is chosen for any package which depends on Flutter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for confusing phrasing (I also saw this bit/left this comment before I saw the autogeneration code). My point was that the similar workflow logic is running/repeated across these categories. You could run them via a matrix to save repitition like the integration tests but I'm not sure how you would stop one category from running on pushes to certain files with that pattern, so I thought that was why you did it this way. Knowing they are autogenerated would also be another reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since paths affect the workflow as a whole and there isn't a way to control this at any lower level from what I've seen. Since it's autogenerated, there's no real maintenance risk to 1 workflow vs. 50. It's also why all the workflow logic is centralized in flutter_vm, so all these files do is control the paths to run on, essentially.

We also have more information about the packages in aft than we do once the workflow is running which is another reason we generate them.

os:
# macos-latest currently points to macos-11
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
- macos-12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callout (no change needed inthis PR): This is going to consume lots of macos compute across its consumers, so just might be something to keep an eye on if we hit a limit at some point. Also dk if people run workflows on their fork like I do where you can only run 5 mac jobs at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. My thinking with these is that they will only run on pushes (not pull requests) so they can run asynchronously without blocking any real work. Open to further discussion, though (maybe run them on a schedule instead?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, can discuss in other forum. For now I think this PR has appropriate change bc good to test these on pushes, could discuss optimizations later. At the root I think a lot of compute consumption is just running aft bootstrap like we discussed for another change, so cutting down at that time would help a lot. The next thing to consider would be things like limiting matrix on pushes/schedules, etc... IMO.

final isDartPackage = package.flavor == PackageFlavor.dart;
final workflowContents = StringBuffer(
'''
name: ${package.name}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit/question: Should this include a comment that they are autogenerated in the output? I had no idea until I got here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Updated 👍

@@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(dnys1): Investigate DDC failures
@Tags(['no-ddc'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Would we ever consider keeping tags in a centralized place as consts/enums? Like maybe in amplify_test? That way they're easier to keep track of/not repeat, etc...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely temporary. At some point, if we have more permanent tags used throughout, that could definitely make sense.

@@ -11,7 +11,7 @@ environment:

dependencies:
amplify_db_common_dart: ^0.1.0
drift: ^2.2.0
drift: ^2.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this changed here/other places?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are from this commit be12ace

- next
pull_request:
paths:
- 'packages/amplify_core/**/*.dart'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fore these patterns, I dk if would make more sense to specify what should NOT run the tests, like !**/*README.md than trying to state what SHOULD and leave this open to errors of omission, but I do not feel strongly one way or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feeling is that CI checks in PRs should do the absolute minimum amount of work to verify the change. This is best accomplished through an "opt-in" rule vs "opt-out". On push, CI checks run for any change and this is a better mechanism for catching things which weren't immediately obvious.

@dnys1 dnys1 enabled auto-merge (rebase) November 16, 2022 17:04
Dillon Nys added 14 commits November 16, 2022 13:40
Adds base workflows for Dart & Flutter packages
Adds a new command for generating GitHub actions workflows
Updates goldens for new CI pipeline
Should be `master` instead of `main`
Generates GitHub Actions workflows for all packages in the repo
Removes mono_repo from the repository
Worker tests fail in DDC right now. Since they are never compiled in DDC mode when published, we don't need to worry about them for now.
Enables web tests in the `aws_signature_v4` package
`amplify_db_common` dependency constraints were set too high for minimum Dart target of 2.17.0
This was removed in `pkg:xml` where it happened automatically (renggli/dart-xml@366149f)
Allows packages to declare a `setup.sh` script to run before running tests to allow for pluggable package-specific setup work.
@dnys1 dnys1 force-pushed the feat/new-ci branch 2 times, most recently from 02bf809 to 542e6ce Compare November 16, 2022 21:02
@dnys1 dnys1 merged commit 7c9a253 into next Nov 16, 2022
@dnys1 dnys1 deleted the feat/new-ci branch November 16, 2022 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants