-
Notifications
You must be signed in to change notification settings - Fork 0
test: Added workflows to test this deploy action #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8fd013b
test: Added 'committed' test mini project
christerswahn a1185f5
test: Added 'non-committed' test mini project
christerswahn c4b6e4c
test: GitHub workflow to test deploy with committed
christerswahn 8704d8b
test: GitHub workflow to test deploy with non-committed
christerswahn 591a3e2
chore: Bumped version in examples to v1
christerswahn e3bec49
test: Made base test case work with flutter build
christerswahn e20d81c
test: Simplified flutter install example clause
christerswahn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Automated Serverpod Cloud deploy | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Flutter SDK | ||
| uses: subosito/flutter-action@v2 | ||
|
|
||
| - name: Activate serverpod command | ||
| run: dart pub global activate serverpod_cli | ||
|
|
||
| - uses: ./ # Directly use the action | ||
| with: | ||
| token: ${{ secrets.MY_SERVERPOD_CLOUD_ACCESS_TOKEN }} | ||
| working_directory: ./test/committed/committed_server | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Automated Serverpod Cloud generate & deploy | ||
| description: > | ||
| Checks out the repository, sets up Flutter, runs serverpod generate, | ||
| and deploys to Serverpod Cloud. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| # Change these values according to your project | ||
| PROJECT_ID: test-action-non-committed-proj | ||
christerswahn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| SERVER_DIR: ./test/non_committed/non_committed_server | ||
christerswahn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CLOUD_TOKEN: ${{ secrets.MY_SERVERPOD_CLOUD_ACCESS_TOKEN }} | ||
|
|
||
| jobs: | ||
| generate-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Flutter SDK | ||
| uses: subosito/flutter-action@v2 | ||
|
|
||
| - name: Run serverpod generate | ||
| working-directory: ${{ env.SERVER_DIR }} | ||
| run: | | ||
| dart pub get | ||
| dart pub global activate serverpod_cli 3.1.1 | ||
| serverpod generate | ||
christerswahn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - uses: ./ # Directly use the action | ||
| with: | ||
| token: ${{ env.CLOUD_TOKEN }} | ||
| project_id: ${{ env.PROJECT_ID }} | ||
| project_dir: ${{ env.SERVER_DIR }} | ||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Files and directories created by pub | ||
| .dart_tool/ | ||
| .packages | ||
|
|
||
| # Omit committing pubspec.lock for library packages: | ||
| # https://dart.dev/guides/libraries/private-files#pubspeclock | ||
| pubspec.lock | ||
|
|
||
| # Conventional directory for build outputs | ||
| build/ | ||
|
|
||
| # Directory created by dartdoc | ||
| doc/api/ |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ## 1.0.0 | ||
|
|
||
| - Initial version, created by Stagehand |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # committed_client | ||
|
|
||
| This is your Serverpod client. The code in here is mostly generated by | ||
| Serverpod, but you may want to make changes if you are adding modules to your | ||
| project. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Defines a default set of lint rules enforced for | ||
| # projects at Google. For details and rationale, | ||
| # see https://github.com/dart-lang/pedantic#enabled-lints. | ||
|
|
||
| # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. | ||
| # Uncomment to specify additional rules. | ||
| # linter: | ||
| # rules: | ||
| # - camel_case_types | ||
|
|
||
| analyzer: | ||
| exclude: | ||
| - lib/src/protocol/** | ||
|
|
||
| formatter: | ||
| trailing_commas: preserve |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| dartdoc: | ||
| categories: | ||
| "Endpoint": | ||
| markdown: doc/endpoint.md | ||
| name: Endpoint |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Callable endpoints | ||
|
|
||
| Each class contains callable methods that will call a method on the server side. These are normally defined in the `endpoint` directory in your server project. This client sends requests to these endpoints and returns the result. | ||
|
|
||
| Example usage: | ||
|
|
||
| ```dart | ||
| // How to use GreetingEndpoint. | ||
| client.greeting.hello("world!"); | ||
|
|
||
| // Generic format. | ||
| client.<endpoint>.<method>(...); | ||
| ``` | ||
|
|
||
| Please see the full official documentation [here](https://docs.serverpod.dev) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export 'src/protocol/protocol.dart'; | ||
| export 'package:serverpod_client/serverpod_client.dart'; |
75 changes: 75 additions & 0 deletions
75
test/committed/committed_client/lib/src/protocol/client.dart
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */ | ||
| /* To generate run: "serverpod generate" */ | ||
|
|
||
| // ignore_for_file: implementation_imports | ||
| // ignore_for_file: library_private_types_in_public_api | ||
| // ignore_for_file: non_constant_identifier_names | ||
| // ignore_for_file: public_member_api_docs | ||
| // ignore_for_file: type_literal_in_constant_pattern | ||
| // ignore_for_file: use_super_parameters | ||
| // ignore_for_file: invalid_use_of_internal_member | ||
|
|
||
| // ignore_for_file: no_leading_underscores_for_library_prefixes | ||
| import 'package:serverpod_client/serverpod_client.dart' as _i1; | ||
| import 'dart:async' as _i2; | ||
| import 'package:committed_client/src/protocol/greetings/greeting.dart' as _i3; | ||
| import 'protocol.dart' as _i4; | ||
|
|
||
| /// This is an example endpoint that returns a greeting message through | ||
| /// its [hello] method. | ||
| /// {@category Endpoint} | ||
| class EndpointGreeting extends _i1.EndpointRef { | ||
| EndpointGreeting(_i1.EndpointCaller caller) : super(caller); | ||
|
|
||
| @override | ||
| String get name => 'greeting'; | ||
|
|
||
| /// Returns a personalized greeting message: "Hello {name}". | ||
| _i2.Future<_i3.Greeting> hello(String name) => | ||
| caller.callServerEndpoint<_i3.Greeting>( | ||
| 'greeting', | ||
| 'hello', | ||
| {'name': name}, | ||
| ); | ||
| } | ||
|
|
||
| class Client extends _i1.ServerpodClientShared { | ||
| Client( | ||
| String host, { | ||
| dynamic securityContext, | ||
| @Deprecated( | ||
| 'Use authKeyProvider instead. This will be removed in future releases.', | ||
| ) | ||
| super.authenticationKeyManager, | ||
| Duration? streamingConnectionTimeout, | ||
| Duration? connectionTimeout, | ||
| Function( | ||
| _i1.MethodCallContext, | ||
| Object, | ||
| StackTrace, | ||
| )? | ||
| onFailedCall, | ||
| Function(_i1.MethodCallContext)? onSucceededCall, | ||
| bool? disconnectStreamsOnLostInternetConnection, | ||
| }) : super( | ||
| host, | ||
| _i4.Protocol(), | ||
| securityContext: securityContext, | ||
| streamingConnectionTimeout: streamingConnectionTimeout, | ||
| connectionTimeout: connectionTimeout, | ||
| onFailedCall: onFailedCall, | ||
| onSucceededCall: onSucceededCall, | ||
| disconnectStreamsOnLostInternetConnection: | ||
| disconnectStreamsOnLostInternetConnection, | ||
| ) { | ||
| greeting = EndpointGreeting(this); | ||
| } | ||
|
|
||
| late final EndpointGreeting greeting; | ||
|
|
||
| @override | ||
| Map<String, _i1.EndpointRef> get endpointRefLookup => {'greeting': greeting}; | ||
|
|
||
| @override | ||
| Map<String, _i1.ModuleEndpointCaller> get moduleLookup => {}; | ||
| } |
98 changes: 98 additions & 0 deletions
98
test/committed/committed_client/lib/src/protocol/greetings/greeting.dart
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */ | ||
| /* To generate run: "serverpod generate" */ | ||
|
|
||
| // ignore_for_file: implementation_imports | ||
| // ignore_for_file: library_private_types_in_public_api | ||
| // ignore_for_file: non_constant_identifier_names | ||
| // ignore_for_file: public_member_api_docs | ||
| // ignore_for_file: type_literal_in_constant_pattern | ||
| // ignore_for_file: use_super_parameters | ||
| // ignore_for_file: invalid_use_of_internal_member | ||
|
|
||
| // ignore_for_file: no_leading_underscores_for_library_prefixes | ||
| import 'package:serverpod_client/serverpod_client.dart' as _i1; | ||
|
|
||
| /// A greeting message which can be sent to or from the server. | ||
| abstract class Greeting implements _i1.SerializableModel { | ||
| Greeting._({ | ||
| required this.message, | ||
| required this.author, | ||
| required this.timestamp, | ||
| }); | ||
|
|
||
| factory Greeting({ | ||
| required String message, | ||
| required String author, | ||
| required DateTime timestamp, | ||
| }) = _GreetingImpl; | ||
|
|
||
| factory Greeting.fromJson(Map<String, dynamic> jsonSerialization) { | ||
| return Greeting( | ||
| message: jsonSerialization['message'] as String, | ||
| author: jsonSerialization['author'] as String, | ||
| timestamp: _i1.DateTimeJsonExtension.fromJson( | ||
| jsonSerialization['timestamp'], | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| /// The greeting message. | ||
| String message; | ||
|
|
||
| /// The author of the greeting message. | ||
| String author; | ||
|
|
||
| /// The time when the message was created. | ||
| DateTime timestamp; | ||
|
|
||
| /// Returns a shallow copy of this [Greeting] | ||
| /// with some or all fields replaced by the given arguments. | ||
| @_i1.useResult | ||
| Greeting copyWith({ | ||
| String? message, | ||
| String? author, | ||
| DateTime? timestamp, | ||
| }); | ||
| @override | ||
| Map<String, dynamic> toJson() { | ||
| return { | ||
| '__className__': 'Greeting', | ||
| 'message': message, | ||
| 'author': author, | ||
| 'timestamp': timestamp.toJson(), | ||
| }; | ||
| } | ||
|
|
||
| @override | ||
| String toString() { | ||
| return _i1.SerializationManager.encode(this); | ||
| } | ||
| } | ||
|
|
||
| class _GreetingImpl extends Greeting { | ||
| _GreetingImpl({ | ||
| required String message, | ||
| required String author, | ||
| required DateTime timestamp, | ||
| }) : super._( | ||
| message: message, | ||
| author: author, | ||
| timestamp: timestamp, | ||
| ); | ||
|
|
||
| /// Returns a shallow copy of this [Greeting] | ||
| /// with some or all fields replaced by the given arguments. | ||
| @_i1.useResult | ||
| @override | ||
| Greeting copyWith({ | ||
| String? message, | ||
| String? author, | ||
| DateTime? timestamp, | ||
| }) { | ||
| return Greeting( | ||
| message: message ?? this.message, | ||
| author: author ?? this.author, | ||
| timestamp: timestamp ?? this.timestamp, | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.