Skip to content

Commit

Permalink
fix: Upgrade to latest dependencies (#120)
Browse files Browse the repository at this point in the history
* fix(ci): Add override melos script

* fix: Upgrade to latest dependencies

* cache hacking

* internal getField

* cleanup obsolete files

* dart fix
  • Loading branch information
j4qfrost committed Oct 23, 2022
1 parent 4ea5f71 commit 8db82e2
Show file tree
Hide file tree
Showing 64 changed files with 261 additions and 1,027 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ jobs:
run: dart pub global activate melos
- name: Strip overrides
run: melos run strip-overrides
- name: Format
run: dart fix --apply && dart format --fix .
- name: Uptick versions
run: melos version --yes
- name: Changelog
run: git diff master packages/conduit/CHANGELOG.md > CHANGES.txt
- name: Cache Source
run: melos cache-source
- name: Dry run
run: melos publish --dry-run --yes
- name: Push tags
Expand Down
91 changes: 36 additions & 55 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,6 @@ on:
workflow_dispatch:

jobs:
test_harness:
env:
TEST_DIR: packages/test_harness
RUNNER_CMD: dart test -r expanded
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: conduit_test_user
POSTGRES_PASSWORD: conduit!
POSTGRES_DB: conduit_test_db
POSTGRES_PORT: 15432
ports:
- 15432:5432
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Get Dependencies
working-directory: ${{ env.TEST_DIR }}
run: dart pub get
- name: Run tests
working-directory: ${{ env.TEST_DIR }}
run: . ../../ci/.env && ${{ env.RUNNER_CMD }}

all_unit:
runs-on: ubuntu-latest
services:
Expand All @@ -53,15 +26,19 @@ jobs:
- name: Get Dependencies
run: |
dart pub global activate melos
melos bootstrap
cd packages/isolate_exec_test_packages/test_package && dart pub get
melos bootstrap
melos cache-source
- name: Run tests
run: . ./ci/.env && melos test-unit
run: melos test-unit

conduit_cli:
env:
TEST_DIR: packages/conduit
runs-on: ubuntu-latest
strategy:
matrix:
runner_args: [dart test -j1 -t cli test/*, dart tool/generated_test_runner.dart]
services:
postgres:
image: postgres:14.5
Expand All @@ -79,35 +56,39 @@ jobs:
sdk: dev
- name: Get Dependencies
working-directory: ${{ env.TEST_DIR }}
run: dart pub get
- name: Run tests
working-directory: ${{ env.TEST_DIR }}
run: . ../../ci/.env && dart test -r expanded -j1 -t cli

conduit_tool:
env:
TEST_DIR: packages/conduit
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: conduit_test_user
POSTGRES_PASSWORD: conduit!
POSTGRES_DB: conduit_test_db
POSTGRES_PORT: 15432
ports:
- 15432:5432
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Prep Packages
run: |
dart pub global activate melos
melos bootstrap
melos cache-source
- name: Run tests
working-directory: ${{ env.TEST_DIR }}
run: . ../../ci/.env && dart tool/generated_test_runner.dart
run: . ../../ci/.env && ${{ matrix.runner_args }}

# For help debugging CI problems should normally be commented out
# single_unit:
# env:
# TEST_DIR: packages/runtime
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres:14.5
# env:
# POSTGRES_USER: conduit_test_user
# POSTGRES_PASSWORD: conduit!
# POSTGRES_DB: conduit_test_db
# POSTGRES_PORT: 15432
# ports:
# - 15432:5432
# steps:
# - uses: actions/checkout@v3
# - uses: dart-lang/setup-dart@v1
# with:
# sdk: dev
# - name: Get Dependencies
# run: |
# dart pub global activate melos
# melos bootstrap
# melos cache-source
# - name: Run tests
# working-directory: ${{ env.TEST_DIR }}
# run: . ../../ci/.env && dart test
10 changes: 9 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ scripts:
select-pacakge:
no-private: true
analyze: melos exec -- pub global run tuneup check
activate-all:
run: melos exec -- "dart pub global activate '\$MELOS_PACKAGE_NAME'"
select-pacakge:
no-private: true
cache-source:
run: melos exec -- "dart pub global activate '\$MELOS_PACKAGE_NAME' && cp -r '\$MELOS_PACKAGE_PATH' '$PUB_CACHE/hosted/pub.dartlang.org/\$MELOS_PACKAGE_NAME-\$MELOS_PACKAGE_VERSION'"
run: melos exec -- "mkdir -p '$PUB_CACHE/hosted/pub.dev/\$MELOS_PACKAGE_NAME-\$MELOS_PACKAGE_VERSION'; cp -R '\$MELOS_PACKAGE_PATH'/* '$PUB_CACHE/hosted/pub.dev/\$MELOS_PACKAGE_NAME-\$MELOS_PACKAGE_VERSION' && ls '$PUB_CACHE/hosted/pub.dev/\$MELOS_PACKAGE_NAME-\$MELOS_PACKAGE_VERSION/' && yq -i 'del(.dependency_overrides)' '$PUB_CACHE/hosted/pub.dev/\$MELOS_PACKAGE_NAME-\$MELOS_PACKAGE_VERSION/pubspec.yaml'"
select-pacakge:
no-private: true
strip-overrides:
run: melos exec -- "yq -i 'del(.dependency_overrides)' '\$MELOS_PACKAGE_PATH/pubspec.yaml'"
select-pacakge:
no-private: true
apply-overrides:
run: melos exec -- "if [ -f '\$MELOS_PACKAGE_PATH/overrides.yaml' ]; then yq -i '. *= load(\"\$MELOS_PACKAGE_PATH/overrides.yaml\")' '\$MELOS_PACKAGE_PATH/pubspec.yaml'; fi"
hard-clean:
run: melos exec -- "rm -rf '\$MELOS_PACKAGE_PATH/.dart_tool' '\$MELOS_PACKAGE_PATH/pubspec.lock'"
environment:
sdk: ">=2.12.0 <3.0.0"

33 changes: 0 additions & 33 deletions packages/codable/.github/workflows/dart.yml

This file was deleted.

3 changes: 0 additions & 3 deletions packages/codable/lib/src/version/version.g.dart

This file was deleted.

2 changes: 1 addition & 1 deletion packages/codable/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:
meta: ^1.3.0
dev_dependencies:
lint: ^1.0.0
test: ^1.16.5
test: ^1.21.6
5 changes: 5 additions & 0 deletions packages/codable/test/encode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,15 @@ void main() {
expect(encoded["archive"] is KeyedArchive, false);
expect(encoded["list"] is List<dynamic>, true);
expect(encoded["list"] is ListArchive, false);
// ignore: avoid_dynamic_calls
expect(encoded["list"][0], "value");
// ignore: avoid_dynamic_calls
expect(encoded["list"][1] is Map<String, dynamic>, true);
// ignore: avoid_dynamic_calls
expect(encoded["list"][1] is KeyedArchive, false);
// ignore: avoid_dynamic_calls
expect(encoded["list"][2] is List<dynamic>, true);
// ignore: avoid_dynamic_calls
expect(encoded["list"][2] is ListArchive, false);
});
}
Expand Down
5 changes: 5 additions & 0 deletions packages/common/overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependency_overrides:
conduit_codable:
path: ../codable
conduit_open_api:
path: ../open_api
5 changes: 5 additions & 0 deletions packages/common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ dependencies:
conduit_open_api: ^3.2.2
dev_dependencies:
lint: ^1.0.0
dependency_overrides:
conduit_codable:
path: ../codable
conduit_open_api:
path: ../open_api
17 changes: 17 additions & 0 deletions packages/common_test/overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dependency_overrides:
conduit:
path: ../conduit
conduit_common:
path: ../common
conduit_open_api:
path: ../open_api
conduit_codable:
path: ../codable
conduit_config:
path: ../config
conduit_isolate_exec:
path: ../isolate_exec
conduit_password_hash:
path: ../password_hash
conduit_runtime:
path: ../runtime
19 changes: 18 additions & 1 deletion packages/common_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,21 @@ environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
conduit: ^3.2.3
conduit_common: ^3.2.2
conduit_common: ^3.2.2
dependency_overrides:
conduit:
path: ../conduit
conduit_common:
path: ../common
conduit_open_api:
path: ../open_api
conduit_codable:
path: ../codable
conduit_config:
path: ../config
conduit_isolate_exec:
path: ../isolate_exec
conduit_password_hash:
path: ../password_hash
conduit_runtime:
path: ../runtime
2 changes: 0 additions & 2 deletions packages/conduit/lib/src/auth/auth_code_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class AuthCodeController extends ResourceController {
@Operation.get()
Future<Response> getAuthorizationPage(
{

/// A space-delimited list of access scopes to be requested by the form submission on the returned page.
@Bind.query("scope") String? scope}) async {
if (delegate == null) {
Expand All @@ -116,7 +115,6 @@ class AuthCodeController extends ResourceController {
@Operation.post()
Future<Response> authorize(
{

/// The username of the authenticating user.
@Bind.query("username") String? username,

Expand Down
2 changes: 0 additions & 2 deletions packages/conduit/lib/src/auth/auth_redirect_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class AuthRedirectController extends ResourceController {
@Operation.get()
Future<Response> getAuthorizationPage(
{

/// A space-delimited list of access scopes to be requested by the form submission on the returned page.
@Bind.query("scope") String? scope}) async {
if (delegate == null) {
Expand Down Expand Up @@ -132,7 +131,6 @@ class AuthRedirectController extends ResourceController {
@Operation.post()
Future<Response> authorize(
{

/// The username of the authenticating user.
@Bind.query("username") String? username,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class ManagedObjectController<InstanceType extends ManagedObject>
@Operation.get()
Future<Response> getObjects(
{

/// Limits the number of objects returned.
@Bind.query("count") int count = 0,

Expand Down
6 changes: 3 additions & 3 deletions packages/conduit/lib/src/runtime/orm_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ManagedEntityRuntimeImpl extends ManagedEntityRuntime
return [annotation.toSource().substring(1)];
} else if (isInstanceOfColumn) {
final originatingLibrary = element.session!
.getParsedLibraryByElement2(element.library) as ParsedLibraryResult;
.getParsedLibraryByElement(element.library) as ParsedLibraryResult;
final elementDeclaration = originatingLibrary
.getElementDeclaration(element.variable)!
.node as VariableDeclaration;
Expand All @@ -160,11 +160,11 @@ class ManagedEntityRuntimeImpl extends ManagedEntityRuntime
// For the property we are looking at, grab all of its annotations from the analyzer.
// We also have all of the instances created by these annotations available in some
// way or another in the [property].
final fieldAnnotations = context.getAnnotationsFromField(
final fieldAnnotations = await context.getAnnotationsFromField(
EntityBuilder.getTableDefinitionForType(property.entity.instanceType)
.reflectedType,
property.name);
final constructorInvocations = (await fieldAnnotations)
final constructorInvocations = fieldAnnotations
.map((annotation) => _getValidatorConstructionFromAnnotation(
context, annotation, property,
importUris: importUris))
Expand Down
3 changes: 0 additions & 3 deletions packages/conduit/lib/src/version/version.g.dart

This file was deleted.

17 changes: 17 additions & 0 deletions packages/conduit/overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dependency_overrides:
conduit_codable:
path: ../codable
conduit_common:
path: ../common
conduit_config:
path: ../config
conduit_isolate_exec:
path: ../isolate_exec
conduit_open_api:
path: ../open_api
conduit_password_hash:
path: ../password_hash
conduit_runtime:
path: ../runtime
conduit_test:
path: ../test_harness
Loading

0 comments on commit 8db82e2

Please sign in to comment.