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

check: Add step to install libsqlite3-dev system dependency #999

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

rajveermalviya
Copy link
Collaborator

The package:sqlite3 requires the system-installed sqlite3 shared library (libsqlite3.so) when running directly via Dart, on Linux. Whereas, when running under Flutter, it uses bundled libraries provided by package:sqlite3_flutter_libs.

Recently, the ubuntu-latest runner image has switched to defaulting to ubuntu-24.04:
actions/runner-images#10636
Previously, it used ubuntu-22.04, which had the libsqlite3-dev package pre-installed:
https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#installed-apt-packages
However, the ubuntu-24.04 image no longer includes this package by default:
https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#installed-apt-packages

As a result, five unit tests now fail with the following error:

Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory
  dart:ffi                                                        new DynamicLibrary.open
  package:sqlite3/src/ffi/load_library.dart 52:27                 _defaultOpen
  package:sqlite3/src/ffi/load_library.dart 127:12                OpenDynamicLibrary.openSqlite
  package:sqlite3/src/ffi/api.dart 13:39                          sqlite3
  package:drift/native.dart 313:12                                _NativeDelegate.openDatabase
  package:drift/src/sqlite3/database.dart 79:19                   Sqlite3Delegate.open
  package:drift/src/runtime/executor/helpers/engines.dart 431:22  DelegatedDatabase.ensureOpen.<fn>

To resolve these test failures, add a step to manually install the libsqlite3-dev package.

@rajveermalviya
Copy link
Collaborator Author

Well, just as I was putting this PR up, it looks like the ubuntu-latest == ubuntu-24.04 rollout is being rolled back:
actions/runner-images#10636 (comment)

fun 😄

@fombalang
Copy link
Contributor

Well, just as I was putting this PR up, it looks like the ubuntu-latest == ubuntu-24.04 rollout is being rolled back: actions/runner-images#10636 (comment)

fun 😄

Oh, I was wondering why some test suddenly failed on the pipeline when I sent in my PR.

@gnprice
Copy link
Member

gnprice commented Oct 16, 2024

Thanks @rajveermalviya for sorting this out! I'd run into the same issue yesterday at #998 (comment) but hadn't yet spent time to investigate.

This seems like a good change even if for the moment it's no longer needed. How about combining it with a change to use ubuntu-24.04 specifically? That way CI would validate for us that the change fully solves the problem.

@rajveermalviya
Copy link
Collaborator Author

Thanks for the review @gnprice! I've updated the commit to also change the checks' runner image to use ubuntu-24.04 explicitly. PTAL.

…tem dependency

Change the runner image to use `ubuntu-24.04` directly, because
`ubuntu-latest` may cause CI failures when there are unexpected changes
in the future versions of the runner image.

Then also add a step to manually install the `libsqlite3-dev` package,
which we need.

The `package:sqlite3` requires the system-installed sqlite3 shared
library (`libsqlite3.so`) when running directly via Dart, on Linux.
Whereas, when running under Flutter, it uses bundled libraries provided
by `package:sqlite3_flutter_libs`.

Previously, with `ubuntu-22.04` the `libsqlite3-dev` package was
pre-installed:
  https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#installed-apt-packages
However, the `ubuntu-24.04` image no longer includes this package by
default:
  https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#installed-apt-packages

Without that package, five unit tests would fail with the following
error:
  Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory
    dart:ffi                                                        new DynamicLibrary.open
    package:sqlite3/src/ffi/load_library.dart 52:27                 _defaultOpen
    package:sqlite3/src/ffi/load_library.dart 127:12                OpenDynamicLibrary.openSqlite
    package:sqlite3/src/ffi/api.dart 13:39                          sqlite3
    package:drift/native.dart 313:12                                _NativeDelegate.openDatabase
    package:drift/src/sqlite3/database.dart 79:19                   Sqlite3Delegate.open
    package:drift/src/runtime/executor/helpers/engines.dart 431:22  DelegatedDatabase.ensureOpen.<fn>
@gnprice
Copy link
Member

gnprice commented Oct 17, 2024

Thanks! Looks good; merging.

I tweaked the commit message, mainly here:

-    As a result, five unit tests now fail with the following error:
+    Without that package, five unit tests would fail with the following
+    error:

because (since GitHub rolled back the change of ubuntu-latest to 24.04) there's no longer a "now" when the unit tests actually do fail; rather it's a hypothetical, that if we just bumped the version without adding this setup step, those tests would fail.

@gnprice gnprice merged commit 26c2aa0 into zulip:main Oct 17, 2024
@rajveermalviya rajveermalviya deleted the pr-fix-ci-sqlite branch October 18, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants