Merge branch 'nico/testing-ci' into 'main'

Fix CI by using the new baseimage as well as fixing openssl 3.0 compat.

See merge request famedly/company/frontend/famedlysdk!1063
This commit is contained in:
Nicolas Werner 2022-06-28 11:17:39 +00:00
commit 55417bcc25
2 changed files with 38 additions and 14 deletions

View File

@ -10,11 +10,14 @@ workflow:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
FLUTTER_IMAGE_TAG: '3.0.3'
coverage: coverage:
tags: tags:
- linux - linux
stage: coverage stage: coverage
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG}
dependencies: [] dependencies: []
script: script:
- sed -i 's/#\([^ ]\)/\1/g' pubspec.yaml - sed -i 's/#\([^ ]\)/\1/g' pubspec.yaml
@ -39,7 +42,7 @@ e2ee_test:
tags: tags:
- linux - linux
stage: coverage stage: coverage
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG}
dependencies: [] dependencies: []
script: script:
- printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart - printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart

View File

@ -18,15 +18,27 @@
import 'dart:ffi'; import 'dart:ffi';
import 'dart:io'; import 'dart:io';
final libcrypto = Platform.isIOS final libcrypto = () {
? DynamicLibrary.process() if (Platform.isIOS) {
: DynamicLibrary.open(Platform.isAndroid return DynamicLibrary.process();
? 'libcrypto.so' } else if (Platform.isAndroid) {
: Platform.isWindows return DynamicLibrary.open('libcrypto.so');
? 'libcrypto.dll' } else if (Platform.isWindows) {
: Platform.isMacOS return DynamicLibrary.open('libcrypto.dll');
? 'libcrypto.1.1.dylib' } else if (Platform.isMacOS) {
: 'libcrypto.so.1.1'); try {
return DynamicLibrary.open('libcrypto.3.dylib');
} catch (_) {
return DynamicLibrary.open('libcrypto.1.1.dylib');
}
} else {
try {
return DynamicLibrary.open('libcrypto.so.3');
} catch (_) {
return DynamicLibrary.open('libcrypto.so.1.1');
}
}
}();
final PKCS5_PBKDF2_HMAC = libcrypto.lookupFunction< final PKCS5_PBKDF2_HMAC = libcrypto.lookupFunction<
IntPtr Function( IntPtr Function(
@ -118,6 +130,15 @@ final EVP_Digest = libcrypto.lookupFunction<
Pointer<NativeType> alg, Pointer<NativeType> alg,
Pointer<NativeType> engine)>('EVP_Digest'); Pointer<NativeType> engine)>('EVP_Digest');
final EVP_MD_size = libcrypto.lookupFunction< final EVP_MD_size = () {
IntPtr Function(Pointer<NativeType> ctx), // EVP_MD_size was renamed to EVP_MD_get_size in Openssl3.0.
int Function(Pointer<NativeType> ctx)>('EVP_MD_size'); // There is an alias macro, but those don't exist in libraries.
// Try loading the new name first, then fall back to the old one if not found.
try {
return libcrypto.lookupFunction<IntPtr Function(Pointer<NativeType> ctx),
int Function(Pointer<NativeType> ctx)>('EVP_MD_get_size');
} catch (e) {
return libcrypto.lookupFunction<IntPtr Function(Pointer<NativeType> ctx),
int Function(Pointer<NativeType> ctx)>('EVP_MD_size');
}
}();