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

Adding github action to validate contextual survey json #104

Merged
merged 15 commits into from
Aug 22, 2023

Conversation

eliasyishak
Copy link
Contributor

@eliasyishak eliasyishak commented Aug 21, 2023

Reference issue:

This will add validation for the json file to ensure the data is correct

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@eliasyishak eliasyishak marked this pull request as ready for review August 21, 2023 19:05
@eliasyishak eliasyishak changed the title Adding schema + yml for workflow Adding github action to validate contextual survey json Aug 21, 2023
@eliasyishak
Copy link
Contributor Author

@jayoung-lee whenever you get a chance to review, this PR will essentially ensure that future updates to the context survey json will be valid and won't break package:unified_analytics

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Great idea to add this!

A few minor drive-by comments to help with future readability/maintainability. I didn't cover too much as I know this is more of a one-off verification script.

Consider also adding a simple analysis workflow to help stay on top of future deprecations or warnings.

surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

I love the extra cleanup after you ran analysis!

Three more minor suggestions to be consistent with the rest of your code:

surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
surveys/validator/json-validator.dart Outdated Show resolved Hide resolved
@parlough
Copy link
Member

parlough commented Aug 22, 2023

As for the analysis question:

I would probably add it as a separate job in the same file, so it doesn't ever block the actual validation. Would something like this work?

  analyze:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: surveys/validator
    steps:
      - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
      - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
      - name: Verify formatting
        run: dart format --output=none --set-exit-if-changed .
      - name: Analyze Dart files
        run: dart analyze --fatal-infos

@flutter flutter deleted a comment from eliasyishak Aug 22, 2023
@parlough
Copy link
Member

parlough commented Aug 22, 2023

I accidentally deleted your comment. I'm so sorry...I meant to delete one of mine. 🙇

Thanks for addressing my comments, I appreciate it!

@eliasyishak
Copy link
Contributor Author

As for the analysis question:

I would probably add it as a separate job in the same file, so it doesn't ever block the actual validation. Would something like this work?

  analyze:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: surveys/validator
    steps:
      - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
      - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
      - name: Verify formatting
        run: dart format --output=none --set-exit-if-changed .
      - name: Analyze Dart files
        run: dart analyze --fatal-infos

Yep! This seems to work as expected, and looks like both jobs ran in my latest commit

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for making those adjustments!

It'll be nice to have this verification.

@eliasyishak eliasyishak merged commit e8d9eee into master Aug 22, 2023
5 checks passed
@eliasyishak eliasyishak deleted the add-github-action-for-json branch August 22, 2023 17:50
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.

2 participants