diff --git a/.github/actions/screenshot-android/action.yml b/.github/actions/screenshot-android/action.yml index 1061ca12b..98d8ad928 100644 --- a/.github/actions/screenshot-android/action.yml +++ b/.github/actions/screenshot-android/action.yml @@ -65,7 +65,26 @@ runs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: | - flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d emulator + DEVICE_NAME="Pixel 6" flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d emulator + + - name: Update Fastlane Metadata + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: | + cd ./android + git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + rm -rf metadata/android/en-US/images/phoneScreenshots/* + cp -r ../../screenshots/. metadata/android/en-US/images/phoneScreenshots/ + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update screenshots for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-android + git branch -m fastlane-android + git push --force origin fastlane-android - name: Upload Screenshots uses: actions/upload-artifact@v4 diff --git a/.github/actions/screenshot-ios/action.yml b/.github/actions/screenshot-ios/action.yml index e54bd94eb..3f8cd1dec 100644 --- a/.github/actions/screenshot-ios/action.yml +++ b/.github/actions/screenshot-ios/action.yml @@ -40,12 +40,31 @@ runs: - name: Capture iPhone Screenshots shell: bash run: | - flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPHONE_DEVICE_MODEL }}" + DEVICE_NAME="${{ inputs.IPHONE_DEVICE_MODEL }}" flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPHONE_DEVICE_MODEL }}" - name: Capture iPad Screenshots shell: bash run: | - flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPAD_DEVICE_MODEL }}" + DEVICE_NAME="${{ inputs.IPAD_DEVICE_MODEL }}" flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPAD_DEVICE_MODEL }}" + + - name: Update Fastlane Metadata + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: | + cd ./iOS + git clone --branch=fastlane-ios --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + rm -rf screenshots/* + cp -r ../../screenshots/. screenshots/ + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update screenshots for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-ios + git branch -m fastlane-ios + git push --force origin fastlane-ios - name: Upload Screenshots uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87ae29d3f..8143955a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,15 +2,14 @@ name: Release on: release: - types: [published] + types: [ published ] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ANDROID_EMULATOR_API: 34 - ANDROID_EMULATOR_ARCH: x86_64 jobs: release: + name: Release if: ${{ github.repository == 'fossasia/badgemagic-app' }} runs-on: ubuntu-latest @@ -18,6 +17,21 @@ jobs: - name: Download repository uses: actions/checkout@v4 + - name: Prepare Secrets (Android) + env: + ENCRYPTED_F10B5E0E5262_IV: ${{ secrets.ENCRYPTED_F10B5E0E5262_IV }} + ENCRYPTED_F10B5E0E5262_KEY: ${{ secrets.ENCRYPTED_F10B5E0E5262_KEY }} + run: | + bash scripts/prep-android-key.sh + + - name: Prepare Secrets (iOS) + if: ${{ github.repository == 'fossasia/badgemagic-app' }} + env: + ENCRYPTED_IOS_IV: ${{ secrets.ENCRYPTED_IOS_IV }} + ENCRYPTED_IOS_KEY: ${{ secrets.ENCRYPTED_IOS_KEY }} + run: | + bash scripts/prep-ios-key.sh + - name: Download Assets id: download-assets run: | @@ -28,13 +42,7 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Android Screenshot Workflow - uses: ./.github/actions/screenshot-android - with: - ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }} - ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }} - - - name: Update Fastlane Metadata + - name: Update Fastlane Metadata (Android) run: | cd ./android git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane @@ -42,20 +50,42 @@ jobs: echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt - rm -rf metadata/android/en-US/images/phoneScreenshots/* - cp -r ../../screenshots/. metadata/android/en-US/images/phoneScreenshots/ - # Force push to fastlane branch git checkout --orphan temporary git add --all . - git commit -am "[Auto] Update metadata for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" git branch -D fastlane-android git branch -m fastlane-android git push --force origin fastlane-android - - name: Push version to production + - name: Push version to production (Android) run: | + cd ./android fastlane promoteToProduction version_code:${{ steps.download-assets.outputs.VERSION_CODE }} if [[ $? -ne 0 ]]; then exit 1 - fi \ No newline at end of file + fi + + - name: Update Fastlane Metadata (iOS) + run: | + cd ./iOS + git clone --branch=fastlane-ios --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + echo "${{ github.event.release.body }}" > metadata/en-US/release_notes.txt + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-ios + git branch -m fastlane-ios + git push --force origin fastlane-ios + + - name: Push version to production (iOS) + run: | + cd ./iOS + fastlane promoteToProduction build_number:${{ steps.download-assets.outputs.VERSION_CODE }} + if [[ $? -ne 0 ]]; then + exit 1 + fi diff --git a/README.md b/README.md index 81810e164..d8d2b89d6 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,20 @@ There are a number of devices with Bluetooth on the market. As far as we can tel ## Screenshots -| | | | -|-------------|-------------|-------------| -| | | | -| | | | -| | | | + + + + + + + + + + + +
+ +
## Reverse-Engineering Bluetooth LE Devices diff --git a/test_integration/screenshots.dart b/test_integration/screenshots.dart index 58ce696f4..d3356032e 100644 --- a/test_integration/screenshots.dart +++ b/test_integration/screenshots.dart @@ -29,7 +29,11 @@ void main() async { final drawBadgeScreenTitle = find.byKey(const ValueKey(drawBadgeScreen)); await pumpUntilFound(tester, homeScreenTitle); - await binding.takeScreenshot('01'); + await tester.pump(const Duration(seconds: 5)); + await tester.pumpAndSettle(); + await tester.pump(const Duration(seconds: 5)); + await tester.pumpAndSettle(); + await binding.takeScreenshot('home_screen'); final animationTabText = find.text('Animation'); await tester.tap(animationTabText); @@ -54,7 +58,7 @@ void main() async { await tester.pump(const Duration(seconds: 5)); await tester.pumpAndSettle(); await tester.pump(const Duration(seconds: 5)); - await binding.takeScreenshot('02'); + await binding.takeScreenshot('text_badge'); await tester.tap(inputField); await tester.pumpAndSettle(); @@ -89,7 +93,7 @@ void main() async { await tester.pumpAndSettle(); await tester.pump(const Duration(seconds: 5)); await tester.pumpAndSettle(); - await binding.takeScreenshot('03'); + await binding.takeScreenshot('emoji_badge'); final invertEffectContainer = find.text('Invert'); await tester.tap(invertEffectContainer); @@ -97,7 +101,7 @@ void main() async { await tester.pumpAndSettle(); await tester.pump(const Duration(seconds: 5)); await tester.pumpAndSettle(); - await binding.takeScreenshot('04'); + await binding.takeScreenshot('inverted_emoji_badge'); await tester.tap(invertEffectContainer); await tester.pumpAndSettle(); @@ -114,7 +118,7 @@ void main() async { await tester.pumpAndSettle(); await tester.pump(const Duration(seconds: 5)); await tester.pumpAndSettle(); - await binding.takeScreenshot('05'); + await binding.takeScreenshot('saved_badges'); state = tester.firstState(find.byType(Scaffold)); state.openDrawer(); @@ -126,7 +130,7 @@ void main() async { await tester.pumpAndSettle(); await tester.pump(const Duration(seconds: 5)); await tester.pumpAndSettle(); - await binding.takeScreenshot('06'); + await binding.takeScreenshot('draw_badge'); }); }); } diff --git a/test_integration/test_driver.dart b/test_integration/test_driver.dart index 49ce58f56..d6f260da1 100644 --- a/test_integration/test_driver.dart +++ b/test_integration/test_driver.dart @@ -4,11 +4,12 @@ import 'dart:io'; import 'package:integration_test/integration_test_driver_extended.dart'; Future main() async { + final deviceName = Platform.environment['DEVICE_NAME'] ?? 'unknown_device'; + final formattedDeviceName = deviceName.replaceAll(RegExp(r'\s+'), '_'); await integrationDriver( onScreenshot: (String screenshotName, List screenshotBytes, [Map? args]) async { - final timeStamp = DateTime.now().millisecondsSinceEpoch.toString(); - final filePath = 'screenshots/$screenshotName-$timeStamp.png'; + final filePath = 'screenshots/$formattedDeviceName-$screenshotName.png'; print('Writing screenshot to $filePath'); final File image = await File(filePath).create(recursive: true);