From 51849f5d079da45a09221ce09fef0009ef883b9d Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Tue, 13 Jun 2023 14:13:23 -0700 Subject: [PATCH] feat(code_push_client): track version (#646) --- .github/actions/verify_version/action.yaml | 3 ++- .github/workflows/main.yaml | 6 +++++- .../analysis_options.yaml | 3 +++ .../shorebird_code_push_client/dart_test.yaml | 3 +++ .../lib/src/version.dart | 2 ++ packages/shorebird_code_push_client/pubspec.yaml | 3 +++ .../test/ensure_build_test.dart | 15 +++++++++++++++ 7 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 packages/shorebird_code_push_client/dart_test.yaml create mode 100644 packages/shorebird_code_push_client/lib/src/version.dart create mode 100644 packages/shorebird_code_push_client/test/ensure_build_test.dart diff --git a/.github/actions/verify_version/action.yaml b/.github/actions/verify_version/action.yaml index e9c68d08..ca8c9a21 100644 --- a/.github/actions/verify_version/action.yaml +++ b/.github/actions/verify_version/action.yaml @@ -1,9 +1,10 @@ name: Verify Version Workflow +description: Verify the version of the package is correct inputs: working_directory: required: false - type: string + description: "The working directory to run the command in" default: "." runs: diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 085eaa0b..f70348af 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -79,8 +79,12 @@ jobs: filters: | shorebird_cli: - ./.github/workflows/main.yaml - - ./.github/actions/dart_package + - ./.github/actions/verify_version/action.yaml - packages/shorebird_cli/** + shorebird_code_push_client: + - ./.github/workflows/main.yaml + - ./.github/actions/verify_version/action.yaml + - packages/shorebird_code_push_client/** build_dart_packages: needs: changes diff --git a/packages/shorebird_code_push_client/analysis_options.yaml b/packages/shorebird_code_push_client/analysis_options.yaml index b388541f..f0d36db3 100644 --- a/packages/shorebird_code_push_client/analysis_options.yaml +++ b/packages/shorebird_code_push_client/analysis_options.yaml @@ -1 +1,4 @@ include: package:very_good_analysis/analysis_options.5.0.0.yaml +analyzer: + exclude: + - lib/src/version.dart diff --git a/packages/shorebird_code_push_client/dart_test.yaml b/packages/shorebird_code_push_client/dart_test.yaml new file mode 100644 index 00000000..34bbdd09 --- /dev/null +++ b/packages/shorebird_code_push_client/dart_test.yaml @@ -0,0 +1,3 @@ +tags: + version-verify: + skip: "Should only be run during pull request. Verifies if version file is updated." diff --git a/packages/shorebird_code_push_client/lib/src/version.dart b/packages/shorebird_code_push_client/lib/src/version.dart new file mode 100644 index 00000000..066f8806 --- /dev/null +++ b/packages/shorebird_code_push_client/lib/src/version.dart @@ -0,0 +1,2 @@ +// Generated code. Do not modify. +const packageVersion = '0.1.0+1'; diff --git a/packages/shorebird_code_push_client/pubspec.yaml b/packages/shorebird_code_push_client/pubspec.yaml index 1cdec24d..682e7822 100644 --- a/packages/shorebird_code_push_client/pubspec.yaml +++ b/packages/shorebird_code_push_client/pubspec.yaml @@ -14,6 +14,9 @@ dependencies: path: ../shorebird_code_push_protocol dev_dependencies: + build_runner: ^2.0.0 + build_verify: ^3.0.0 + build_version: ^2.0.0 mocktail: ^0.3.0 path: ^1.8.3 test: ^1.19.2 diff --git a/packages/shorebird_code_push_client/test/ensure_build_test.dart b/packages/shorebird_code_push_client/test/ensure_build_test.dart new file mode 100644 index 00000000..a247b6f1 --- /dev/null +++ b/packages/shorebird_code_push_client/test/ensure_build_test.dart @@ -0,0 +1,15 @@ +@Tags(['version-verify']) +library; + +import 'package:build_verify/build_verify.dart'; +import 'package:test/test.dart'; + +void main() { + test( + 'ensure_build', + () => expectBuildClean( + packageRelativeDirectory: 'packages/shorebird_code_push_client', + ), + timeout: const Timeout.factor(2), + ); +}