Skip to content

Commit

Permalink
feat: add setup_sqlite3 lib helper
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Oct 13, 2024
1 parent f3fc96b commit bc92390
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 52 deletions.
4 changes: 1 addition & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
34 changes: 16 additions & 18 deletions ci/README.md
Original file line number Diff line number Diff line change
@@ -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
```
2 changes: 1 addition & 1 deletion ci/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include: package:lints/recommended.yaml
include: package:tekartik_lints/package.yaml
6 changes: 6 additions & 0 deletions ci/bin/setup_sqlite3lib.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:tekartik_ci/setup_ci_github.dart';

Future<void> main() async {
/// Linux only, no op on other platforms
await sudoSetupSqlite3Lib();
}
6 changes: 6 additions & 0 deletions ci/lib/ci_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -19,6 +21,8 @@ Future setup() async {

String _fixDirName(String dirName) => normalize(absolute(dirName));

/// Old generate
@Deprecated('To remove')
Future<bool> generate(
{required String dirName, String? appName, bool? force}) async {
force ??= false;
Expand Down Expand Up @@ -58,6 +62,8 @@ Future<bool> generate(
return true;
}

/// Old flutter test
@Deprecated('To remove')
Future flutterTest(Shell shell) async {
await shell.run('''
Expand Down
1 change: 1 addition & 0 deletions ci/lib/setup_ci_github.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'src/setup/setup_sqlite3lib.dart' show sudoSetupSqlite3Lib;
13 changes: 13 additions & 0 deletions ci/lib/src/setup/setup_sqlite3lib.dart
Original file line number Diff line number Diff line change
@@ -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<void> 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');
}
}
12 changes: 10 additions & 2 deletions ci/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
19 changes: 0 additions & 19 deletions ci/test/ci_test.dart

This file was deleted.

9 changes: 0 additions & 9 deletions ci/tool/cirrus_ci_test.dart

This file was deleted.

6 changes: 6 additions & 0 deletions ci/tool/pub_global_activate.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:process_run/shell.dart';

Future<void> main() async {
/// Run step
await run('dart pub global run tekartik_ci:setup_sqlite3lib');
}
6 changes: 6 additions & 0 deletions ci/tool/pub_global_activate_git.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:process_run/shell.dart';

Future<void> main() async {
await run(
'dart pub global activate --source git git@github.com:tekartikprv/tools.dart.git --git-path ci --git-ref dart3a');
}
6 changes: 6 additions & 0 deletions ci/tool/pub_global_run_setup_sqlite3lib.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:dev_build/shell.dart';

Future<void> main() async {
/// Run step
await run('dart pub global run tekartik_ci:setup_sqlite3lib');
}
4 changes: 4 additions & 0 deletions ci/tool/setup_sqlite3lib.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bc92390

Please sign in to comment.