From 0ddee4b2609a15994f2f06b1de59adcda2ed225a Mon Sep 17 00:00:00 2001 From: nwithan8 Date: Thu, 21 Dec 2023 23:20:19 -0700 Subject: [PATCH 1/2] - Add PR CI GitHub Actions - Add Makefile - Add Dart 3 support - Bump HTTP dependency to v1.1 --- .github/workflows/tests_on_pr.yml | 35 +++++++++++++++++++++++++++++++ Makefile | 7 +++++++ pubspec.yaml | 6 +++--- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/tests_on_pr.yml create mode 100644 Makefile diff --git a/.github/workflows/tests_on_pr.yml b/.github/workflows/tests_on_pr.yml new file mode 100644 index 0000000..7c90994 --- /dev/null +++ b/.github/workflows/tests_on_pr.yml @@ -0,0 +1,35 @@ +name: Run unit tests on PR + +on: + pull_request: ~ + workflow_dispatch: ~ + +jobs: + + # Run unit tests + tests: + name: 'Run unit tests' + runs-on: ubuntu-latest + steps: + # Checkout repository + - uses: actions/checkout@v3 + + # Setup Dart SDK + - uses: dart-lang/setup-dart@main + + # Set temporary version number + - name: Set temporary version number + uses: jacobtomlinson/gha-find-replace@2.0.0 + with: + find: "VERSIONADDEDBYGITHUB" + replace: "1.0.0" + regex: false + + # Minimal package setup + - name: Install dependencies + run: dart pub get + working-directory: ${{ inputs.working-directory }} + + # Run unit tests + - name: Run unit tests + run: make unit_tests diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..76e0f3e --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +## help - Display help about make targets for this Makefile +help: + @cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t + +## unit_tests - Run unit tests +unit_tests: + dart test test/tests.dart diff --git a/pubspec.yaml b/pubspec.yaml index 716b286..11b224f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,10 +4,10 @@ version: VERSIONADDEDBYGITHUB repository: https://github.com/nwithan8/dartvcr environment: - sdk: '>=2.18.2 <3.0.0' + sdk: '>=2.18.2' dependencies: - http: ^0.13.0 + http: ^1.1.0 http_parser: ^4.0.0 json_annotation: ^4.7.0 meta: ^1.3.0 @@ -19,7 +19,7 @@ dev_dependencies: collection: ^1.15.0 dependency_validator: json_serializable: ^6.0.0 - lints: ^2.0.0 + lints: ^3.0.0 mockito: ^5.0.0 pub_semver: test: ^1.16.0 From b850a22ef5a895bf5040c92cc4b2e6449d65ffc7 Mon Sep 17 00:00:00 2001 From: nwithan8 Date: Thu, 21 Dec 2023 23:34:41 -0700 Subject: [PATCH 2/2] - Add more dart shortcuts to Makefile --- Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Makefile b/Makefile index 76e0f3e..f7347bf 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,36 @@ help: ## unit_tests - Run unit tests unit_tests: dart test test/tests.dart + +## temp_version - Set temporary version number +temp_version: + @sed -i 's/VERSIONADDEDBYGITHUB/1.0.0/g' pubspec.yaml + + +## github_version - Set version number for GitHub Actions +github_version: + @sed -i 's/1.0.0/VERSIONADDEDBYGITHUB/g' pubspec.yaml + +## pull_deps - Pull dependencies +pull_deps: + @make temp_version + dart pub get + @make github_version + +## update_deps - Update dependencies +update_deps: + @make temp_version + dart pub upgrade + @make github_version + +## outdated_deps - Check for outdated dependencies +outdated_deps: + @make temp_version + dart pub outdated + @make github_version + +## json_files - Generate JSON files +json_files: + @make temp_version + @dart run build_runner build + @make github_version