Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5fd4e40

Browse files
authored
fix: Check cli integrity (#164)
* put smokes in os files * add dependcy caching to build command * core concurrency 1
1 parent 1cbe6b2 commit 5fd4e40

10 files changed

Lines changed: 95 additions & 8 deletions

File tree

.github/workflows/linux.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,25 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
linux:
13+
smoke:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: dart-lang/setup-dart@v1
18+
with:
19+
sdk: dev
20+
- name: Setup Conduit
21+
run: |
22+
dart pub global activate -spath packages/cli
23+
- name: Run tests
24+
working-directory: ../
25+
run: |
26+
conduit create -t db_and_auth wildfire
27+
cd wildfire/
28+
echo "----------- Building test project -----------"
29+
conduit build
30+
unit:
31+
needs: smoke
1432
if: |
1533
startsWith(github.head_ref, 'feature/')
1634
|| startsWith(github.head_ref, 'fix/')

.github/workflows/macos.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,25 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
macos:
13+
smoke:
14+
runs-on: macos-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: dart-lang/setup-dart@v1
18+
with:
19+
sdk: dev
20+
- name: Setup Conduit
21+
run: |
22+
dart pub global activate -spath packages/cli
23+
- name: Run tests
24+
working-directory: ../
25+
run: |
26+
conduit create -t db_and_auth wildfire
27+
cd wildfire/
28+
echo "----------- Building test project -----------"
29+
conduit build
30+
unit:
31+
needs: smoke
1432
if: |
1533
startsWith(github.head_ref, 'feature/')
1634
|| startsWith(github.head_ref, 'fix/')

.github/workflows/windows.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,25 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
windows:
13+
smoke:
14+
runs-on: windows-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: dart-lang/setup-dart@v1
18+
with:
19+
sdk: dev
20+
- name: Setup Conduit
21+
run: |
22+
dart pub global activate -spath packages/cli
23+
- name: Run tests
24+
working-directory: ../
25+
run: |
26+
conduit create -t db_and_auth wildfire
27+
cd wildfire/
28+
echo "----------- Building test project -----------"
29+
conduit build
30+
unit:
31+
needs: smoke
1432
if: |
1533
startsWith(github.head_ref, 'feature/')
1634
|| startsWith(github.head_ref, 'fix/')

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ stackoverflow
2929
**/.failed_tracker
3030
migration_tmp
3131
coverage
32+
application_test/
3233

3334
doc/
3435
site/

packages/cli/dart_test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
timeout: 120s
1+
timeout: 120s
2+
concurrency: 1

packages/cli/lib/src/cli/commands/build.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ class CLIBuild extends CLICommand with CLIProject {
4444
getScriptSource(await getChannelName()),
4545
);
4646

47+
final cfg = await ctx.packageConfig;
48+
49+
final packageNames = cfg.packages
50+
.where((pkg) => pkg.name.startsWith('conduit_'))
51+
.map((pkg) => pkg.name);
52+
53+
const String cmd = "dart";
54+
final args = ["pub", "cache", "add", "-v", projectVersion!.toString()];
55+
for (final String name in packageNames) {
56+
final res = await Process.run(
57+
cmd,
58+
[...args, name],
59+
runInShell: true,
60+
);
61+
if (res.exitCode != 0) {
62+
final retry = await Process.run(
63+
cmd,
64+
[...args.sublist(0, 3), name],
65+
runInShell: true,
66+
);
67+
if (retry.exitCode != 0) {
68+
print("${res.stdout}");
69+
print("${res.stderr}");
70+
throw StateError(
71+
"'pub get' failed with the following message: ${res.stderr}",
72+
);
73+
}
74+
}
75+
}
76+
4777
final bm = BuildManager(ctx);
4878
await bm.build();
4979

packages/cli/lib/src/cli/mixins/project.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ abstract class CLIProject implements CLICommand {
6666
final lockFileContents = loadYaml(lockFile.readAsStringSync()) as Map;
6767
final projectVersion =
6868
// ignore: avoid_dynamic_calls
69-
lockFileContents["packages"]["conduit"]["version"] as String;
69+
lockFileContents["packages"]["conduit_core"]["version"] as String;
7070
_projectVersion = Version.parse(projectVersion);
7171
}
7272

packages/cli/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
io: ^1.0.3
2020
logging: ^1.0.0
2121
meta: ^1.1.5
22-
path: ^1.6.1
22+
path: ^1.8.0
2323
postgres: ^2.3.1
2424
pub_cache: ^0.3.0
2525
pub_semver: ^2.0.0

packages/core/dart_test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
timeout: 120s
1+
timeout: 120s
2+
concurrency: 1

packages/core/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
io: ^1.0.3
1919
logging: ^1.0.0
2020
meta: ^1.1.5
21-
path: ^1.6.1
21+
path: ^1.8.0
2222
postgres: ^2.3.1
2323
pub_cache: ^0.3.0
2424
pub_semver: ^2.0.0

0 commit comments

Comments
 (0)