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: Check cli integrity #164

Merged
merged 13 commits into from
Jan 8, 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
20 changes: 19 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,25 @@ concurrency:
cancel-in-progress: true

jobs:
linux:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Setup Conduit
run: |
dart pub global activate -spath packages/cli
- name: Run tests
working-directory: ../
run: |
conduit create -t db_and_auth wildfire
cd wildfire/
echo "----------- Building test project -----------"
conduit build
unit:
needs: smoke
if: |
startsWith(github.head_ref, 'feature/')
|| startsWith(github.head_ref, 'fix/')
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,25 @@ concurrency:
cancel-in-progress: true

jobs:
macos:
smoke:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Setup Conduit
run: |
dart pub global activate -spath packages/cli
- name: Run tests
working-directory: ../
run: |
conduit create -t db_and_auth wildfire
cd wildfire/
echo "----------- Building test project -----------"
conduit build
unit:
needs: smoke
if: |
startsWith(github.head_ref, 'feature/')
|| startsWith(github.head_ref, 'fix/')
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,25 @@ concurrency:
cancel-in-progress: true

jobs:
windows:
smoke:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Setup Conduit
run: |
dart pub global activate -spath packages/cli
- name: Run tests
working-directory: ../
run: |
conduit create -t db_and_auth wildfire
cd wildfire/
echo "----------- Building test project -----------"
conduit build
unit:
needs: smoke
if: |
startsWith(github.head_ref, 'feature/')
|| startsWith(github.head_ref, 'fix/')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ stackoverflow
**/.failed_tracker
migration_tmp
coverage
application_test/

doc/
site/
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
timeout: 120s
timeout: 120s
concurrency: 1
30 changes: 30 additions & 0 deletions packages/cli/lib/src/cli/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,36 @@ class CLIBuild extends CLICommand with CLIProject {
getScriptSource(await getChannelName()),
);

final cfg = await ctx.packageConfig;

final packageNames = cfg.packages
.where((pkg) => pkg.name.startsWith('conduit_'))
.map((pkg) => pkg.name);

const String cmd = "dart";
final args = ["pub", "cache", "add", "-v", projectVersion!.toString()];
for (final String name in packageNames) {
final res = await Process.run(
cmd,
[...args, name],
runInShell: true,
);
if (res.exitCode != 0) {
final retry = await Process.run(
cmd,
[...args.sublist(0, 3), name],
runInShell: true,
);
if (retry.exitCode != 0) {
print("${res.stdout}");
print("${res.stderr}");
throw StateError(
"'pub get' failed with the following message: ${res.stderr}",
);
}
}
}

final bm = BuildManager(ctx);
await bm.build();

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/src/cli/mixins/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class CLIProject implements CLICommand {
final lockFileContents = loadYaml(lockFile.readAsStringSync()) as Map;
final projectVersion =
// ignore: avoid_dynamic_calls
lockFileContents["packages"]["conduit"]["version"] as String;
lockFileContents["packages"]["conduit_core"]["version"] as String;
_projectVersion = Version.parse(projectVersion);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
io: ^1.0.3
logging: ^1.0.0
meta: ^1.1.5
path: ^1.6.1
path: ^1.8.0
postgres: ^2.3.1
pub_cache: ^0.3.0
pub_semver: ^2.0.0
Expand Down
3 changes: 2 additions & 1 deletion packages/core/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
timeout: 120s
timeout: 120s
concurrency: 1
2 changes: 1 addition & 1 deletion packages/core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
io: ^1.0.3
logging: ^1.0.0
meta: ^1.1.5
path: ^1.6.1
path: ^1.8.0
postgres: ^2.3.1
pub_cache: ^0.3.0
pub_semver: ^2.0.0
Expand Down