Initial commit
This commit is contained in:
229
.github/workflows/integrate.yaml
vendored
Normal file
229
.github/workflows/integrate.yaml
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
name: Pull Request Workflow
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
jobs:
|
||||
code_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: webiny/action-conventional-commits@v1.4.2
|
||||
- name: Check licenses
|
||||
uses: fsfe/reuse-action@v6
|
||||
- run: ./scripts/generate-locale-config.sh
|
||||
- run: git diff --exit-code
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version-file: .tool_versions.yaml
|
||||
cache: true
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Check for empty translations
|
||||
run: |
|
||||
if grep -rn '": ""' lib/l10n/*.arb; then
|
||||
echo "❌ Found empty translation strings."
|
||||
exit 1
|
||||
fi
|
||||
- run: flutter pub get
|
||||
- name: Check if pubspec.lock is up to date
|
||||
run: git diff --exit-code pubspec.lock
|
||||
- name: Check formatting
|
||||
run: dart format lib/ test/ --set-exit-if-changed
|
||||
- name: Check license compliance
|
||||
run: dart run license_checker check-licenses -c licenses.yaml --problematic
|
||||
- name: Check for unused translations
|
||||
run: |
|
||||
dart pub global activate sweeper
|
||||
dart pub global run sweeper check
|
||||
- run: flutter analyze
|
||||
- name: Search unused dependencies
|
||||
run: |
|
||||
dart pub global activate dependency_validator
|
||||
dart pub global run dependency_validator
|
||||
- run: dart run dart_code_linter:metrics analyze lib --reporter=github
|
||||
- run: dart run dart_code_linter:metrics check-unused-code lib
|
||||
- run: dart run dart_code_linter:metrics check-unused-files lib
|
||||
- run: dart run dart_code_linter:metrics check-unused-l10n lib
|
||||
- name: Check for commented-out Dart code with semicolons
|
||||
run: |
|
||||
if grep -R --include="*.dart" -nE '^[[:space:]]*//[^/<].*;[[:space:]]*$' lib/; then
|
||||
echo ""
|
||||
echo "❌ Found commented-out Dart code ending with semicolon."
|
||||
exit 1
|
||||
fi
|
||||
- name: Add Firebase Messaging
|
||||
run: ./scripts/add-firebase-messaging.sh
|
||||
- run: flutter analyze
|
||||
- run: flutter test
|
||||
|
||||
build_debug_apk:
|
||||
needs: [ code_tests ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: ./.github/actions/free_up_space
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version-file: .tool_versions.yaml
|
||||
cache: true
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: gradle-${{ runner.os }}-
|
||||
- run: ./scripts/add-firebase-messaging.sh
|
||||
- run: flutter build apk --debug --target-platform android-x64
|
||||
- name: Upload Debug APK
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: debug-apk-x64
|
||||
path: build/app/outputs/flutter-apk/app-debug.apk
|
||||
|
||||
build_debug_web:
|
||||
needs: [ code_tests ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version-file: .tool_versions.yaml
|
||||
cache: true
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
||||
- run: flutter pub get
|
||||
- name: Prepare web
|
||||
run: ./scripts/prepare-web.sh
|
||||
- run: git diff --exit-code
|
||||
- run: flutter build web
|
||||
- name: Upload Web Build
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Web Build
|
||||
path: build/web
|
||||
|
||||
build_debug_linux:
|
||||
needs: [ code_tests ]
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ x64, arm64 ]
|
||||
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest'}}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get update && sudo apt-get install git wget 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 libssl-dev libwebkit2gtk-4.1-dev libpulse-dev -y
|
||||
- run: echo "FLUTTER_VERSION=$(yq '.environment.flutter' < .tool_versions.yaml)" >> $GITHUB_ENV
|
||||
- name: Install Flutter
|
||||
run: |
|
||||
git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git
|
||||
./flutter/bin/flutter doctor
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: ./flutter/bin/flutter pub get
|
||||
- run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }}
|
||||
|
||||
build_debug_ios:
|
||||
needs: [ code_tests ]
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version-file: .tool_versions.yaml
|
||||
cache: true
|
||||
- name: Use specific XCode version
|
||||
run: sudo xcode-select --switch /Applications/Xcode_26.3.app
|
||||
- run: brew install sqlcipher
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: ./scripts/add-firebase-messaging.sh
|
||||
- run: flutter pub get
|
||||
- run: flutter build ios --no-codesign
|
||||
|
||||
integration_test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
needs: [ code_tests ]
|
||||
strategy:
|
||||
matrix:
|
||||
api-level: [34]
|
||||
env:
|
||||
ANDROID_USER_HOME: /home/runner/.android
|
||||
ANDROID_EMULATOR_HOME: /home/runner/.android
|
||||
ANDROID_AVD_HOME: /home/runner/.android/avd
|
||||
AVD_CONFIG_PATH: "~/.android/avd/test.avd/config.ini"
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: ./.github/actions/free_up_space
|
||||
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
|
||||
- name: Enable KVM group perms
|
||||
run: |
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
- name: AVD cache
|
||||
uses: actions/cache@v6
|
||||
id: avd-cache
|
||||
with:
|
||||
path: ~/.android/*
|
||||
key: avd-${{ matrix.api-level }}-integration_docker
|
||||
- name: create AVD and generate snapshot for caching
|
||||
if: steps.avd-cache.outputs.cache-hit != 'true'
|
||||
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
|
||||
with:
|
||||
api-level: ${{ matrix.api-level }}
|
||||
target: google_apis
|
||||
arch: x86_64
|
||||
cores: 4
|
||||
ndk: 28.2.13676358
|
||||
force-avd-creation: false
|
||||
disk-size: 4096M
|
||||
ram-size: 4096M
|
||||
sdcard-path-or-size: 4096M
|
||||
emulator-options: -no-window -wipe-data -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
||||
script: |
|
||||
cat ${{ env.AVD_CONFIG_PATH }}
|
||||
|
||||
sed -i.bak 's/hw.lcd.density = .*/hw.lcd.density=420/' ${{ env.AVD_CONFIG_PATH }}
|
||||
sed -i.bak 's/hw.lcd.height = .*/hw.lcd.height=1920/' ${{ env.AVD_CONFIG_PATH }}
|
||||
sed -i.bak 's/hw.lcd.width = .*/hw.lcd.width=1080/' ${{ env.AVD_CONFIG_PATH }}
|
||||
|
||||
if ! grep -q "hw.lcd.density" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.density = 420" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
|
||||
if ! grep -q "hw.lcd.height" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.height = 1920" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
|
||||
if ! grep -q "hw.lcd.width" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.width = 1080" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
|
||||
|
||||
echo "Emulator settings (${{ env.AVD_CONFIG_PATH }})"
|
||||
cat ${{ env.AVD_CONFIG_PATH }}
|
||||
echo "Generated AVD snapshot for caching."
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version-file: .tool_versions.yaml
|
||||
cache: true
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: gradle-${{ runner.os }}-
|
||||
- name: Prepare Homeserver
|
||||
run: ./scripts/prepare_integration_test.sh
|
||||
- name: Integration tests
|
||||
id: integration_tests
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: ${{ matrix.api-level }}
|
||||
target: google_apis
|
||||
arch: x86_64
|
||||
cores: 16
|
||||
ndk: 28.2.13676358
|
||||
force-avd-creation: false
|
||||
disk-size: 4096M
|
||||
ram-size: 4096M
|
||||
sdcard-path-or-size: 4096M
|
||||
emulator-options: -no-snapshot-save -no-window -wipe-data -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
||||
script: flutter test integration_test/mobile_test.dart
|
||||
Reference in New Issue
Block a user