chore: use Famedly runners

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-11-28 07:12:40 +01:00
parent 47ce29d00d
commit 162e7300d5
13 changed files with 118 additions and 77 deletions

View File

@ -20,18 +20,30 @@ code_analyze:
artifacts:
reports:
codequality: code-quality-report.json
tags:
- docker
- famedly
widget_test:
stage: test
script: [flutter test]
tags:
- docker
- famedly
# the basic integration test configuration testing FLOSS builds on Synapse
.integration_test:
integration_test:
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/integration/stable:${FLUTTER_VERSION}
stage: test
services:
- name: docker:dind
alias: docker
parallel:
matrix:
- HOMESERVER_IMPLEMENTATION:
- synapse
- dendrite
- conduit
variables:
# activate container-to-container networking
FF_NETWORK_PER_BUILD: "true"
@ -41,82 +53,65 @@ widget_test:
DOCKER_DRIVER: overlay2
# Disable TLS since we're running inside local network.
DOCKER_TLS_CERTDIR: ""
HOMESERVER: "docker"
before_script:
# start AVD and keep running in background
- scripts/integration-start-avd.sh &
- scripts/integration-prepare-alpine.sh
# create test user environment variables
- source scripts/integration-create-environment-variables.sh
# create Synapse instance
- scripts/integration-server-synapse.sh
- scripts/integration-server-${HOMESERVER_IMPLEMENTATION}.sh
# properly set the homeserver IP and create test users
- scripts/integration-prepare-homeserver.sh
# ensure the homeserver works
- curl docker:8008/_matrix/static/ 2> /dev/null | grep "It works! Synapse is running"
script:
- flutter pub get
- flutter test integration_test
allow_failure: true
tags:
- android
- docker
- famedly
timeout: 20m
# integration tests for Linux builds
.integration_test_linux:
extends: integration_test
script:
- apk add cmake ninja gtk+3.0-dev clang pkgconf xz-dev libsecret-dev jsoncpp-dev
- flutter pub get
- flutter test integration_test -d linux
# extending the default tests to test the Google-flavored builds
.integration_test_google:
extends: .integration_test
integration_test_proprietary:
extends: integration_test
script:
- git apply ./scripts/enable-android-google-services.patch
- flutter pub get
- flutter test integration_test
allow_failure: true
# extending the default tests to use Conduit as local homeserver
.integration_test_conduit:
extends: .integration_test
before_script:
# start AVD and keep running in background
- scripts/integration-start-avd.sh &
- scripts/integration-prepare-alpine.sh
# create Conduit instance
- scripts/integration-server-conduit.sh
# properly set the homeserver IP and create test users
- scripts/integration-prepare-homeserver.sh
# ensure the homeserver works
- curl docker:8008/_matrix/static/ 2> /dev/null | grep "M_NOT_FOUND" 1> /dev/null && echo "Conduit is running!"
allow_failure: true
# extending the default tests to use Dendrite as local homeserver
.integration_test_dendrite:
extends: .integration_test
before_script:
# start AVD and keep running in background
- scripts/integration-start-avd.sh &
- scripts/integration-prepare-alpine.sh
# create Dendrite instance
- scripts/integration-server-dendrite.sh
# properly set the homeserver IP and create test users
- scripts/integration-prepare-homeserver.sh
# ensure the homeserver works
- curl docker:8008/_matrix/static/ 2> /dev/null | grep "404 page not found" 1> /dev/null && echo "Dendrite is running!"
allow_failure: true
.release_mode_launches:
release_mode_launches:
parallel:
matrix:
- FLAVOR:
- floss
- proprietary
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/integration/stable:${FLUTTER_VERSION}
stage: test
before_script:
- |
if [ "$FLAVOR" == "proprietary" ]; then
git apply ./scripts/enable-android-google-services.patch
fi
script:
# start AVD and keep running in background
- scripts/integration-start-avd.sh &
# generate temporary release build configuration and ensure app launches
- scripts/integration-check-release-build.sh
allow_failure: true
tags:
- android
- docker
- famedly
timeout: 20m
.release_mode_launches_google:
extends: .release_mode_launches
before_script:
- git apply ./scripts/enable-android-google-services.patch
allow_failure: true
build_web:
stage: build
before_script:
@ -144,7 +139,8 @@ build_android_debug:
stage: build
script: [./scripts/build-android-debug.sh]
tags:
- android
- docker
- famedly
artifacts:
when: on_success
paths:
@ -160,7 +156,8 @@ build_android_apk:
- ./scripts/prepare-android-release.sh
script: [./scripts/build-android-apk.sh]
tags:
- android
- docker
- famedly
artifacts:
when: on_success
paths:
@ -176,7 +173,8 @@ deploy_playstore_internal:
- ./scripts/prepare-android-release.sh
script: [./scripts/release-playstore-beta.sh]
tags:
- android
- docker
- famedly
artifacts:
when: on_success
paths:

View File

@ -41,8 +41,8 @@ void main() {
final inputs = find.byType(TextField);
await tester.enterText(inputs.first, Users.alice.name);
await tester.enterText(inputs.last, Users.alice.password);
await tester.enterText(inputs.first, Users.user1.name);
await tester.enterText(inputs.last, Users.user1.password);
await tester.testTextInput.receiveAction(TextInputAction.done);
});
});

View File

@ -297,7 +297,7 @@ listeners:
# If you plan to use a reverse proxy, please see
# https://matrix-org.github.io/synapse/latest/reverse_proxy.html.
#
- port: 8008
- port: 80
tls: false
type: http
x_forwarded: false

View File

@ -1,8 +1,16 @@
import 'dart:io';
abstract class Users {
const Users._();
static const alice = User('alice', 'AliceInWonderland');
static const bob = User('bob', 'JoWirSchaffenDas');
static const trudy = User('trudy', 'HaveIBeenPwned');
static final user1 = User(
Platform.environment['USER1_NAME'] ?? 'alice',
Platform.environment['USER1_PW'] ?? 'AliceInWonderland',
);
static final user2 = User(
Platform.environment['USER2_NAME'] ?? 'bob',
Platform.environment['USER2_PW'] ?? 'JoWirSchaffenDas',
);
}
class User {
@ -12,5 +20,5 @@ class User {
const User(this.name, this.password);
}
// https://stackoverflow.com/a/33088657
const homeserver = 'http://10.0.2.2:8008';
final homeserver =
'http://${Platform.environment['HOMESERVER'] ?? 'localhost'}';

View File

@ -11,6 +11,7 @@
#include <emoji_picker_flutter/emoji_picker_flutter_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <handy_window/handy_window_plugin.h>
#include <record_linux/record_linux_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
@ -31,6 +32,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
g_autoptr(FlPluginRegistrar) flutter_webrtc_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterWebRTCPlugin");
flutter_web_r_t_c_plugin_register_with_registrar(flutter_webrtc_registrar);
g_autoptr(FlPluginRegistrar) handy_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "HandyWindowPlugin");
handy_window_plugin_register_with_registrar(handy_window_registrar);

View File

@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
emoji_picker_flutter
file_selector_linux
flutter_secure_storage_linux
flutter_webrtc
handy_window
record_linux
url_launcher_linux

View File

@ -685,7 +685,7 @@ packages:
name: flutter_webrtc
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.14"
version: "0.9.17"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter

View File

@ -47,7 +47,7 @@ dependencies:
flutter_secure_storage: ^6.0.0
flutter_typeahead: ^4.0.0
flutter_web_auth: ^0.5.0
flutter_webrtc: 0.9.14 # Pinned because >0.9.14 add Linux support which lets build fail
flutter_webrtc: ^0.9.17
future_loading_dialog: ^0.2.3
geolocator: ^7.6.2
handy_window: ^0.1.6

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
export USER1_NAME="alice"
export USER1_PW="AliceInWonderland"
export USER2_NAME="bob"
export USER2_PW="JoWirSchaffenDas"

View File

@ -1,8 +1,35 @@
#!/usr/bin/env bash
IP_ADDRESS="$(drill docker | grep -m 1 -P "\d+\.\d+\.\d+.\d+" | awk -F ' ' '{print $NF}')"
sed -i "s/10.0.2.2/$IP_ADDRESS/g" integration_test/users.dart
if [ -z $HOMESERVER ]; then
echo "Please ensure HOMESERVER environment variable is set to the IP or hostname of the homeserver."
exit 1
fi
if [ -z $USER1_NAME ]; then
echo "Please ensure USER1_NAME environment variable is set to first user name."
exit 1
fi
if [ -z $USER1_PW ]; then
echo "Please ensure USER1_PW environment variable is set to first user password."
exit 1
fi
if [ -z $USER2_NAME ]; then
echo "Please ensure USER2_NAME environment variable is set to second user name."
exit 1
fi
if [ -z $USER2_PW ]; then
echo "Please ensure USER2_PW environment variable is set to second user password."
exit 1
fi
curl -XPOST -d '{"username":"alice", "password":"AliceInWonderland", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS:8008/_matrix/client/r0/register"
curl -XPOST -d '{"username":"bob", "password":"JoWirSchaffenDas", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS:8008/_matrix/client/r0/register"
curl -XPOST -d '{"username":"trudy", "password":"HaveIBeenPwned", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS:8008/_matrix/client/r0/register"
echo "Waiting for homeserver to be available... (GET http://$HOMESERVER/_matrix/client/v3/login)"
while ! curl -XGET "http://$HOMESERVER/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
sleep 2
done
echo "Homeserver is up."
# create users
curl -fS --retry 3 -XPOST -d "{\"username\":\"$USER1_NAME\", \"password\":\"$USER1_PW\", \"inhibit_login\":true, \"auth\": {\"type\":\"m.login.dummy\"}}" "http://$HOMESERVER/_matrix/client/r0/register"
curl -fS --retry 3 -XPOST -d "{\"username\":\"$USER2_NAME\", \"password\":\"$USER2_PW\", \"inhibit_login\":true, \"auth\": {\"type\":\"m.login.dummy\"}}" "http://$HOMESERVER/_matrix/client/r0/register"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
docker run -d \
docker run -d \
-e CONDUIT_SERVER_NAME="localhost" \
-e CONDUIT_PORT="8008" \
-e CONDUIT_DATABASE_BACKEND="rocksdb" \
@ -9,6 +9,4 @@
-e CONDUIT_TRUSTED_SERVERS="[\"conduit.rs\"]" \
-e CONDUIT_MAX_CONCURRENT_REQUESTS="100" \
-e CONDUIT_LOG="info,rocket=off,_=off,sled=off" \
--name conduit -p 8008:8008 matrixconduit/matrix-conduit:latest
sleep 20
--name conduit -p 80:8008 matrixconduit/matrix-conduit:latest

View File

@ -10,7 +10,5 @@ docker run --rm --entrypoint="" \
-tls-cert /mnt/server.crt \
-tls-key /mnt/server.key
docker run -d --volume="$(pwd)/integration_test/dendrite/data":/etc/dendrite:rw \
--name dendrite -p 8008:8008 matrixdotorg/dendrite-monolith:latest -really-enable-open-registration
sleep 20
docker run -d --volume="$(pwd)/integration_test/dendrite/data":/etc/dendrite:rw \
--name dendrite -p 80:8008 matrixdotorg/dendrite-monolith:latest -really-enable-open-registration

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
chown -R 991:991 integration_test/synapse
docker run -d --name synapse --user 991:991 --volume="$(pwd)/integration_test/synapse/data":/data:rw -p 8008:8008 matrixdotorg/synapse:latest
sleep 20
docker run -d --name synapse --tmpfs /data \
--volume="$(pwd)/integration_test/synapse/data/homeserver.yaml":/data/homeserver.yaml:rw \
--volume="$(pwd)/integration_test/synapse/data/localhost.log.config":/data/localhost.log.config:rw \
-p 80:80 matrixdotorg/synapse:latest