refactor: Switch from maestro to flutter integration tests
This commit is contained in:
parent
c15be05246
commit
0a42f28cf1
34 changed files with 495 additions and 727 deletions
|
|
@ -1,67 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
GITLAB_PROJECT_ID="16112282"
|
||||
|
||||
# repo directory for build
|
||||
mkdir fdroid/repo
|
||||
# ... and for deployment
|
||||
mkdir repo
|
||||
|
||||
git fetch
|
||||
|
||||
# building nightly repo
|
||||
|
||||
cd fdroid
|
||||
|
||||
cp config.nightly.py config.py
|
||||
|
||||
PIPELINES="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines\?ref=main\&status=success\&order_by=updated_at | jq '.[].id' | head -n3)"
|
||||
|
||||
cp ../build/android/app-release.apk repo/fluffychat-latest.apk
|
||||
|
||||
for PIPELINE in $PIPELINES
|
||||
do
|
||||
JOB="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/$PIPELINE/jobs | jq -r '.[] | select(.name == "build_android_apk").id')"
|
||||
if [ -n $JOB ]; then
|
||||
URI="https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/jobs/$JOB/artifacts/build/android/app-release.apk"
|
||||
FILENAME="fluffychat-$PIPELINE.apk"
|
||||
echo "Downloading $FILENAME from $URI ..."
|
||||
wget --output-document="$FILENAME" "$URI"
|
||||
mv "$FILENAME" repo
|
||||
fi
|
||||
done
|
||||
|
||||
fdroid update --rename-apks
|
||||
mkdir /fdroid && fdroid deploy
|
||||
rm -rf /fdroid/archive
|
||||
cd .. && mv -v /fdroid repo/nightly
|
||||
|
||||
# building stable + RC repo
|
||||
|
||||
rm -rf /fdroid fdroid/repo
|
||||
|
||||
mkdir fdroid/repo
|
||||
|
||||
cd fdroid
|
||||
rm -f repo/*.apk
|
||||
|
||||
cp config.stable.py config.py
|
||||
|
||||
PIPELINES="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines\?scope=tags\&status=success\&order_by=updated_at | jq '.[].id' | head -n3)"
|
||||
|
||||
for PIPELINE in $PIPELINES
|
||||
do
|
||||
JOB="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/$PIPELINE/jobs | jq -r '.[] | select(.name == "build_android_apk").id')"
|
||||
if [ -n $JOB ]; then
|
||||
URI="https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/jobs/$JOB/artifacts/build/android/app-release.apk"
|
||||
FILENAME="fluffychat-$PIPELINE.apk"
|
||||
echo "Downloading $FILENAME from $URI ..."
|
||||
wget --output-document="$FILENAME" "$URI"
|
||||
mv "$FILENAME" repo
|
||||
fi
|
||||
done
|
||||
|
||||
fdroid update --rename-apks
|
||||
mkdir /fdroid && fdroid deploy
|
||||
rm -rf /fdroid/archive
|
||||
cd .. && mv -v /fdroid repo/stable
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# generate a temporary signing key adn apply its configuration
|
||||
cd android
|
||||
KEYFILE="$(pwd)/key.jks"
|
||||
echo "Generating signing configuration with $KEYFILE..."
|
||||
keytool -genkey -keyalg RSA -alias key -keysize 4096 -dname "cn=FluffyChat CI, ou=Head of bad integration tests, o=FluffyChat HQ, c=TLH" -keypass FLUFFYCHAT -storepass FLUFFYCHAT -validity 1 -keystore "$KEYFILE" -storetype "pkcs12"
|
||||
echo "storePassword=FLUFFYCHAT" >> key.properties
|
||||
echo "keyPassword=FLUFFYCHAT" >> key.properties
|
||||
echo "keyAlias=key" >> key.properties
|
||||
echo "storeFile=$KEYFILE" >> key.properties
|
||||
ls | grep key
|
||||
cd ..
|
||||
|
||||
# build release mode APK
|
||||
flutter pub get
|
||||
flutter build apk --release
|
||||
|
||||
# install and launch APK
|
||||
flutter install
|
||||
adb shell am start -n chat.fluffy.fluffychat/chat.fluffy.fluffychat.MainActivity
|
||||
|
||||
sleep 5
|
||||
|
||||
# check whether FluffyChat runs
|
||||
adb shell ps | awk '{print $9}' | grep chat.fluffy.fluffychat
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
while ! curl -XGET "http://localhost/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
|
||||
echo "Waiting for homeserver to be available... (GET http://localhost/_matrix/client/v3/login)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# create users
|
||||
curl -fS --retry 3 -XPOST -d "{\"username\":\"$USER1_NAME\", \"password\":\"$USER1_PW\", \"inhibit_login\":true, \"auth\": {\"type\":\"m.login.dummy\"}}" "http://localhost/_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://localhost/_matrix/client/r0/register"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
if ! command -v apk &>/dev/null; then
|
||||
apt update && apt install -y -qq docker.io ldnsutils grep scrcpy ffmpeg
|
||||
else
|
||||
apk update && apk add docker drill grep scrcpy ffmpeg
|
||||
fi
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
docker run -d \
|
||||
-e CONDUIT_SERVER_NAME="localhost" \
|
||||
-e CONDUIT_PORT="8008" \
|
||||
-e CONDUIT_DATABASE_BACKEND="rocksdb" \
|
||||
-e CONDUIT_ALLOW_REGISTRATION=true \
|
||||
-e CONDUIT_ALLOW_FEDERATION=true \
|
||||
-e CONDUIT_MAX_REQUEST_SIZE="20000000" \
|
||||
-e CONDUIT_TRUSTED_SERVERS="[\"conduit.rs\"]" \
|
||||
-e CONDUIT_MAX_CONCURRENT_REQUESTS="100" \
|
||||
-e CONDUIT_LOG="info,rocket=off,_=off,sled=off" \
|
||||
--name conduit -p 80:8008 matrixconduit/matrix-conduit:latest
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
chown -R 991:991 integration_test/dendrite
|
||||
|
||||
# creating integration test SSL certificates
|
||||
docker run --rm --entrypoint="" \
|
||||
--volume="$(pwd)/integration_test/dendrite/data":/mnt:rw \
|
||||
matrixdotorg/dendrite-monolith:latest \
|
||||
/usr/bin/generate-keys \
|
||||
-private-key /mnt/matrix_key.pem \
|
||||
-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 80:8008 matrixdotorg/dendrite-monolith:latest -really-enable-open-registration
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
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
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
chmod 777 -R /dev/kvm
|
||||
adb start-server
|
||||
emulator -avd test -wipe-data -no-audio -no-boot-anim -no-window -accel on -gpu swiftshader_indirect
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cp -r android/fastlane fdroid/metadata/chat.fluffy.fluffychat
|
||||
cd fdroid
|
||||
echo $FDROID_KEY | base64 --decode --ignore-garbage > key.jks
|
||||
echo $FDROID_NIGHTLY_KEY | base64 --decode --ignore-garbage > key.nightly.jks
|
||||
echo "keypass=\"${FDROID_KEY_PASS}\"" >> config.stable.py
|
||||
echo "keystorepass=\"${FDROID_KEY_PASS}\"" >> config.stable.py
|
||||
echo "keypass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py
|
||||
echo "keystorepass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py
|
||||
chmod 600 config.stable.py key.jks config.nightly.py key.nightly.jks
|
||||
cd ..
|
||||
23
scripts/prepare_integration_test.sh
Executable file
23
scripts/prepare_integration_test.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source integration_test/data/integration_users.env
|
||||
|
||||
docker rm -f synapse 2>/dev/null || true
|
||||
|
||||
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
|
||||
|
||||
while ! curl -XGET "http://$HOMESERVER/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
|
||||
echo "Waiting for homeserver to be available... (GET http://$HOMESERVER/_matrix/client/v3/login)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Homeserver is online!"
|
||||
|
||||
# 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"
|
||||
|
||||
echo "Homeserver is ready! Please rerun this script every time before starting an integration test!"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh -ve
|
||||
flutter pub upgrade --major-versions
|
||||
flutter pub get
|
||||
dart fix --apply
|
||||
flutter format lib test
|
||||
flutter pub run import_sorter:main --no-comments
|
||||
Loading…
Add table
Add a link
Reference in a new issue