From b30622c1b9c994e98944eaff986f455dfd2ad861 Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 19 Mar 2023 07:44:02 +0100 Subject: [PATCH] refactor: CI scripts and old workarounds for build scripts --- .gitlab-ci.yml | 45 +++++++++++++++++++++++++--------- scripts/build-android-apk.sh | 5 ---- scripts/build-android-debug.sh | 2 -- scripts/build-linux.sh | 5 ---- scripts/build-macos.sh | 9 ------- scripts/build-web.sh | 7 ------ scripts/code_analyze.sh | 8 ------ 7 files changed, 33 insertions(+), 48 deletions(-) delete mode 100755 scripts/build-android-apk.sh delete mode 100755 scripts/build-android-debug.sh delete mode 100755 scripts/build-linux.sh delete mode 100755 scripts/build-macos.sh delete mode 100755 scripts/build-web.sh delete mode 100755 scripts/code_analyze.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a3c8d73..79bf3eb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,15 @@ stages: code_analyze: stage: test - script: [ ./scripts/code_analyze.sh ] + script: + - flutter pub get + - dart run import_sorter:main --no-comments --exit-if-changed + - flutter format lib/ test/ --set-exit-if-changed + - flutter analyze + - git apply ./scripts/enable-android-google-services.patch + - flutter pub get + - flutter analyze + - flutter pub run dart_code_metrics:metrics lib -r gitlab > code-quality-report.json || true artifacts: reports: codequality: code-quality-report.json @@ -66,9 +74,8 @@ integration_test: - ffmpeg -i video.mkv -vf scale=iw/2:-2 -crf 40 -b:v 2000k -preset fast video.mp4 || true timeout: 30m retry: 2 - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: always + only: + - tags artifacts: when: always paths: @@ -129,6 +136,8 @@ release_mode_launches: # generate temporary release build configuration and ensure app launches - scripts/integration-check-release-build.sh timeout: 20m + only: + - tags tags: - docker - famedly @@ -137,7 +146,8 @@ build_web: stage: build before_script: [ sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh ] - script: [ ./scripts/build-web.sh ] + script: + - flutter build web --release --verbose --source-maps artifacts: paths: - build/web/ @@ -186,11 +196,14 @@ build_windows: build_android_debug: stage: build - script: [ ./scripts/build-android-debug.sh ] + script: [ flutter build apk --debug ] artifacts: when: on_success paths: - build/app/outputs/apk/debug/app-debug.apk + tags: + - docker + - famedly except: - main - tags @@ -200,11 +213,14 @@ build_android_apk: before_script: - git apply ./scripts/enable-android-google-services.patch - ./scripts/prepare-android-release.sh - script: [ ./scripts/build-android-apk.sh ] + script: [ flutter build apk --release ] artifacts: when: on_success paths: - - build/android/app-release.apk + - build/app/outputs/apk/release/app-release.apk + tags: + - docker + - famedly only: - main - tags @@ -220,6 +236,9 @@ deploy_playstore_internal: paths: - build/android/app-release.aab resource_group: playstore_release + tags: + - docker + - famedly only: - main @@ -268,10 +287,12 @@ build_linux_x86: stage: build image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable before_script: - [ - sudo apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration -y && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 -y, - ] - script: [ ./scripts/build-linux.sh ] + - sudo apt-get update + - sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 -y + script: [ flutter build linux --release -v ] + tags: + - docker + - famedly artifacts: when: on_success paths: diff --git a/scripts/build-android-apk.sh b/scripts/build-android-apk.sh deleted file mode 100755 index 4b1b641b..00000000 --- a/scripts/build-android-apk.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -flutter pub get -flutter build apk --release -mkdir -p build/android -cp build/app/outputs/apk/release/app-release.apk build/android/ diff --git a/scripts/build-android-debug.sh b/scripts/build-android-debug.sh deleted file mode 100755 index 5c2744a4..00000000 --- a/scripts/build-android-debug.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -flutter build apk --debug diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh deleted file mode 100755 index e1df0e60..00000000 --- a/scripts/build-linux.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ve -flutter config --enable-linux-desktop -flutter clean -flutter pub get -flutter build linux --release -v diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh deleted file mode 100755 index 3a9ca059..00000000 --- a/scripts/build-macos.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -ve -flutter config --enable-macos-desktop -flutter clean -flutter pub get -cd macos -pod install -pod update -cd .. -flutter build macos --release diff --git a/scripts/build-web.sh b/scripts/build-web.sh deleted file mode 100755 index 8be903b7..00000000 --- a/scripts/build-web.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -ve -flutter config --enable-web -flutter clean -flutter pub get -flutter build web --release --verbose --source-maps -# bug of the Flutter engine -chmod +r -R build/web \ No newline at end of file diff --git a/scripts/code_analyze.sh b/scripts/code_analyze.sh deleted file mode 100755 index c0249a7c..00000000 --- a/scripts/code_analyze.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ve -flutter pub get -flutter pub run import_sorter:main --no-comments --exit-if-changed -flutter format lib/ test/ --set-exit-if-changed -git apply ./scripts/enable-android-google-services.patch -flutter pub get -flutter analyze -flutter pub run dart_code_metrics:metrics lib -r gitlab > code-quality-report.json || true \ No newline at end of file