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

fix(actions): send metrics on pr and send none values #4058

Merged
merged 10 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions .github/composite_actions/log_cw_metric/dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/composite_actions/log_cw_metric/dist/main.cjs.map

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions .github/composite_actions/log_cw_metric_wrapper/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ inputs:
runs:
using: "composite"
steps:
- name: Exit if not scheduled
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you want to track metrics for every single test trigger?

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, at least for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do this shouldn't we track the trigger type? Otherwise we have no means to separate schedules from PR tests that are failing because the PR is half done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's a great point - let me think on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done - sending event type now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Where are you sending this event type or other means to distinguish events based on whether they were triggered by a PR / scheduled / 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.

shell: bash
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
echo "This was not triggered by a schedule, skipping."
echo "SKIP_CW=true" >> $GITHUB_ENV
fi

- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
if: env.SKIP_CW != 'true'
with:
Expand All @@ -83,7 +75,7 @@ runs:
job-status: ${{ inputs.job-status }}
github-token: ${{ inputs.github-token }}

metric-name: "github_metric_2.0"
fjnoyp marked this conversation as resolved.
Show resolved Hide resolved
metric-name: "github_metric_2.1"
test-type: ${{ inputs.test-type }}
working-directory: ${{ inputs.working-directory }}

Expand Down
41 changes: 21 additions & 20 deletions .github/composite_actions/setup_chromedriver/dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions .github/composite_actions/setup_chromedriver/dist/main.cjs.map

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions actions/bin/log_cw_metric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import 'package:collection/collection.dart';
Future<void> main(List<String> args) => wrapMain(logMetric);

Future<void> logMetric() async {
const defaultValue = 'none';

// Inputs for Failing Step
final jobStatus = core.getRequiredInput('job-status');

Expand Down Expand Up @@ -104,19 +106,22 @@ Future<void> logMetric() async {

final workflowName = '${github.context.workflow}/${github.context.job}';

final framework = core.getInput('framework', defaultValue: '');
final framework = core.getInput('framework', defaultValue: defaultValue);
if (!['dart', 'flutter'].contains(framework)) {
throw Exception(
'framework input of $framework must be one of: dart, flutter',
);
}
final flutterDartChannel =
core.getInput('flutter-dart-channel', defaultValue: '');
final dartVersion = core.getInput('dart-version', defaultValue: '');
final flutterVersion = core.getInput('flutter-version', defaultValue: '');
final dartCompiler = core.getInput('dart-compiler', defaultValue: '');
final platform = core.getInput('platform', defaultValue: '');
final platformVersion = core.getInput('platform-version', defaultValue: '');
core.getInput('flutter-dart-channel', defaultValue: defaultValue);
final dartVersion = core.getInput('dart-version', defaultValue: defaultValue);
final flutterVersion =
core.getInput('flutter-version', defaultValue: defaultValue);
final dartCompiler =
core.getInput('dart-compiler', defaultValue: defaultValue);
final platform = core.getInput('platform', defaultValue: defaultValue);
final platformVersion =
core.getInput('platform-version', defaultValue: defaultValue);

final value = isFailed ? '1' : '0';

Expand All @@ -131,6 +136,7 @@ Future<void> logMetric() async {
'dart-compiler': dartCompiler,
'platform': platform,
'platform-version': platformVersion,
'event-name': github.context.eventName,
//if (failingStep.isNotEmpty) 'failing-step': failingStep,
};

Expand Down
2 changes: 1 addition & 1 deletion actions/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: ^3.2.0-150.0.dev

dependencies:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, the github action was pulling in a very old version of aws_common that was missing a Stream Extension we were relying on. Bumping the version to avoid a slew of "method not supported on Stream" exceptions.

aws_common: any
aws_common: ^0.6.1
collection: ^1.18.0
js: ^0.6.7
json_annotation: ">=4.8.1 <4.9.0"
Expand Down
Loading