diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 34eee74..8e3392a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,22 +3,20 @@ version: 2 enable-beta-ecosystems: true + updates: - package-ecosystem: "pub" directory: "ci" schedule: interval: "monthly" - - package-ecosystem: "pub" directory: "ci_support" schedule: interval: "monthly" - - package-ecosystem: "pub" directory: "repo_support" schedule: interval: "monthly" - - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/ci/README.md b/ci/README.md index 69e2468..65d0f1b 100644 --- a/ci/README.md +++ b/ci/README.md @@ -1,22 +1,20 @@ -A library for Dart developers. +# Setup tools for ci -Created from templates made available by Stagehand under a BSD-style -[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). +## Sqlite 3 -## Usage - -A simple usage example: - -```dart -import 'package:tekartik_ci/ci_flutter.dart'; - -main() { - -} +If you ever encounter +``` +Failed to load dynamic library 'libsqlite3.so' ``` -## Features and bugs - -Please file feature requests and bugs at the [issue tracker][tracker]. - -[tracker]: http://example.com/issues/replaceme +you can include the following steps in your github actions workflow: + +```yaml +jobs: + build: + steps: + - name: Install libsqlite3-dev + run: | + dart pub global activate --source git git@github.com:tekartikprv/tools.dart.git --git-path ci --git-ref dart3a + dart pub global run tekartik_ci:setup_sqlite3lib +``` \ No newline at end of file diff --git a/ci/analysis_options.yaml b/ci/analysis_options.yaml index ea2c9e9..bc5cf48 100644 --- a/ci/analysis_options.yaml +++ b/ci/analysis_options.yaml @@ -1 +1 @@ -include: package:lints/recommended.yaml \ No newline at end of file +include: package:tekartik_lints/package.yaml \ No newline at end of file diff --git a/ci/bin/setup_sqlite3lib.dart b/ci/bin/setup_sqlite3lib.dart new file mode 100644 index 0000000..97c6545 --- /dev/null +++ b/ci/bin/setup_sqlite3lib.dart @@ -0,0 +1,6 @@ +import 'package:tekartik_ci/setup_ci_github.dart'; + +Future main() async { + /// Linux only, no op on other platforms + await sudoSetupSqlite3Lib(); +} diff --git a/ci/lib/ci_flutter.dart b/ci/lib/ci_flutter.dart index 4f205b0..dacf90e 100644 --- a/ci/lib/ci_flutter.dart +++ b/ci/lib/ci_flutter.dart @@ -4,6 +4,8 @@ import 'package:path/path.dart'; import 'package:process_run/shell.dart'; import 'package:pub_semver/pub_semver.dart'; +/// Old setup +@Deprecated('To remove') Future setup() async { if (shellEnvironment.containsKey('TEKARTIK_CI_CIRRUS')) { stdout.writeln('Cirrus flutter setup'); @@ -19,6 +21,8 @@ Future setup() async { String _fixDirName(String dirName) => normalize(absolute(dirName)); +/// Old generate +@Deprecated('To remove') Future generate( {required String dirName, String? appName, bool? force}) async { force ??= false; @@ -58,6 +62,8 @@ Future generate( return true; } +/// Old flutter test +@Deprecated('To remove') Future flutterTest(Shell shell) async { await shell.run(''' diff --git a/ci/lib/setup_ci_github.dart b/ci/lib/setup_ci_github.dart new file mode 100644 index 0000000..d4a4e33 --- /dev/null +++ b/ci/lib/setup_ci_github.dart @@ -0,0 +1 @@ +export 'src/setup/setup_sqlite3lib.dart' show sudoSetupSqlite3Lib; diff --git a/ci/lib/src/setup/setup_sqlite3lib.dart b/ci/lib/src/setup/setup_sqlite3lib.dart new file mode 100644 index 0000000..c9fb4f9 --- /dev/null +++ b/ci/lib/src/setup/setup_sqlite3lib.dart @@ -0,0 +1,13 @@ +import 'package:process_run/shell.dart'; +import 'package:process_run/stdio.dart'; + +/// Setup sqlite3, only needed for linux, to run with sudo +Future sudoSetupSqlite3Lib() async { + /// Add extra tools to build on linux + /// + /// Can only be called from CI without any sudo access issue. + if (Platform.isLinux) { + // Assuming ubuntu, to run as sudo + await run('sudo apt-get -y install libsqlite3-dev'); + } +} diff --git a/ci/pubspec.yaml b/ci/pubspec.yaml index e618f96..ac2f347 100644 --- a/ci/pubspec.yaml +++ b/ci/pubspec.yaml @@ -11,9 +11,17 @@ environment: dependencies: meta: path: ^1.6.0 - process_run: '>=0.10.4+1' + process_run: '>=1.2.0' + dev_build: ">=1.0.1" io: pub_semver: dev_dependencies: lints: '>=1.0.0' - test: ^1.6.0 + tekartik_lints: + git: + url: https://github.com/tekartik/common.dart + ref: dart3a + path: packages/lints + test: ">=1.6.0" +executables: + setup_sqlite3lib: \ No newline at end of file diff --git a/ci/test/ci_test.dart b/ci/test/ci_test.dart deleted file mode 100644 index 7a67328..0000000 --- a/ci/test/ci_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:path/path.dart'; -import 'package:process_run/shell.dart'; -import 'package:tekartik_ci/ci_flutter.dart'; -import 'package:test/test.dart'; - -var top = join('.dart_tool', 'tekartik_ci'); - -void main() { - group('flutter', () { - setUp(() {}); - - test('flutter test', () async { - var dirName = join(top, 'tekartik_simple_app'); - await generate(dirName: dirName, force: true); - var shell = Shell(workingDirectory: dirName); - await flutterTest(shell); - }, timeout: Timeout(Duration(minutes: 5))); - }); -} diff --git a/ci/tool/cirrus_ci_test.dart b/ci/tool/cirrus_ci_test.dart deleted file mode 100644 index 2abaf81..0000000 --- a/ci/tool/cirrus_ci_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:process_run/shell.dart'; - -Future main() async { - var shell = Shell(); - - await shell.run(''' -dart pub run test -'''); -} diff --git a/ci/tool/pub_global_activate.dart b/ci/tool/pub_global_activate.dart new file mode 100644 index 0000000..88feb0a --- /dev/null +++ b/ci/tool/pub_global_activate.dart @@ -0,0 +1,6 @@ +import 'package:process_run/shell.dart'; + +Future main() async { + /// Run step + await run('dart pub global run tekartik_ci:setup_sqlite3lib'); +} diff --git a/ci/tool/pub_global_activate_git.dart b/ci/tool/pub_global_activate_git.dart new file mode 100644 index 0000000..c42fd32 --- /dev/null +++ b/ci/tool/pub_global_activate_git.dart @@ -0,0 +1,6 @@ +import 'package:process_run/shell.dart'; + +Future main() async { + await run( + 'dart pub global activate --source git git@github.com:tekartikprv/tools.dart.git --git-path ci --git-ref dart3a'); +} diff --git a/ci/tool/pub_global_run_setup_sqlite3lib.dart b/ci/tool/pub_global_run_setup_sqlite3lib.dart new file mode 100644 index 0000000..4f16c1f --- /dev/null +++ b/ci/tool/pub_global_run_setup_sqlite3lib.dart @@ -0,0 +1,6 @@ +import 'package:dev_build/shell.dart'; + +Future main() async { + /// Run step + await run('dart pub global run tekartik_ci:setup_sqlite3lib'); +} diff --git a/ci/tool/setup_sqlite3lib.sh b/ci/tool/setup_sqlite3lib.sh new file mode 100755 index 0000000..3c949e8 --- /dev/null +++ b/ci/tool/setup_sqlite3lib.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +dart pub global activate --source git git@github.com:tekartikprv/tools.dart.git --git-path ci --git-ref dart3a +dart pub global run tekartik_ci:setup_sqlite3lib \ No newline at end of file