Add notification history #8668
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| DEVELOPER_DIR: /Applications/Xcode_26.4.app/Contents/Developer | |
| FASTLANE_SKIP_UPDATE_CHECK: true | |
| FASTLANE_XCODE_LIST_TIMEOUT: 80 | |
| FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 80 | |
| HOMEBREW_NO_INSTALL_CLEANUP: TRUE | |
| BUNDLE_PATH: vendor/bundle | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | |
| with: | |
| ruby-version: "3.1" | |
| bundler-cache: true | |
| - name: YamlLint | |
| run: yamllint --strict --format github . | |
| - name: RuboCop | |
| run: bundle exec rubocop --format github | |
| - name: SwiftLint | |
| run: | | |
| docker run --rm -v `pwd`:`pwd` -w `pwd` \ | |
| ghcr.io/realm/swiftlint:0.54.0 \ | |
| swiftlint lint --strict --config .swiftlint.yml --reporter github-actions-logging | |
| - name: SwiftFormat | |
| run: | | |
| docker run --rm -v `pwd`:`pwd` -w `pwd` \ | |
| ghcr.io/nicklockwood/swiftformat:0.53.1 \ | |
| --lint --config .swiftformat . | |
| check-swiftlint-disables: | |
| needs: lint | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper git diff | |
| - name: Scan for `swiftlint:disable` in PR diff | |
| id: scan | |
| continue-on-error: false | |
| run: | | |
| git fetch origin main:refs/remotes/origin/main | |
| DISABLE_LINES=$(git diff origin/main -- '*.swift' | grep -E '^\+.*// swiftlint:disable' || true) | |
| echo "disable_lines<<EOF" >> $GITHUB_OUTPUT | |
| echo "$DISABLE_LINES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Comment on PR if `swiftlint:disable` is found | |
| if: steps.scan.outputs.disable_lines != '' && github.event.pull_request.head.repo.full_name == github.repository | |
| uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4 | |
| with: | |
| header: swiftlint-disable-check | |
| message: | | |
| ⚠️ **SwiftLint disabled in this PR** | |
| The following added lines contain `// swiftlint:disable`. Please verify this is necessary. | |
| check-unused-strings: | |
| needs: lint | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 # Fetch all history for comparison with main branch | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v5.3.0 | |
| with: | |
| python-version: '3.x' | |
| - name: Detect unused L10n strings | |
| id: detect | |
| continue-on-error: true | |
| run: | | |
| OUTPUT=$(python3 Tools/detect_unused_strings.py 2>&1 || true) | |
| echo "output<<EOF" >> $GITHUB_OUTPUT | |
| echo "$OUTPUT" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # Last non-empty line is the comma-separated list of unused keys, | |
| # ready to paste into the "Lokalise: Delete Keys" workflow. | |
| KEYS=$(printf '%s\n' "$OUTPUT" | awk 'NF { last = $0 } END { print last }') | |
| echo "keys<<EOF" >> $GITHUB_OUTPUT | |
| echo "$KEYS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # Check if any unused strings were found | |
| if echo "$OUTPUT" | grep -q "Total unused:"; then | |
| COUNT=$(echo "$OUTPUT" | grep "Total unused:" | grep -oE '[0-9]+') | |
| echo "has_unused=true" >> $GITHUB_OUTPUT | |
| echo "count=$COUNT" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_unused=false" >> $GITHUB_OUTPUT | |
| echo "count=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Comment on PR if unused strings are found | |
| if: | | |
| steps.detect.outputs.has_unused == 'true' && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4 | |
| with: | |
| header: unused-strings-check | |
| message: | | |
| ⚠️ **Unused L10n strings detected** | |
| Found **${{ steps.detect.outputs.count }}** unused localization strings in the codebase. | |
| <details> | |
| <summary>Click to see details</summary> | |
| ``` | |
| ${{ steps.detect.outputs.output }} | |
| ``` | |
| </details> | |
| To remove them, run the | |
| [Lokalise: Delete Keys](${{ github.event.repository.html_url }}/actions/workflows/delete_lokalise_keys.yml) | |
| workflow — it deletes the keys from Lokalise and opens a PR removing them from | |
| `Localizable.strings` and regenerating `Strings.swift`. Copy-paste these keys into the **keys** input: | |
| ``` | |
| ${{ steps.detect.outputs.keys }} | |
| ``` | |
| test: | |
| needs: check-swiftlint-disables | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | |
| with: | |
| ruby-version: .ruby-version | |
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| name: "Cache: Pods" | |
| id: cache_pods | |
| with: | |
| path: | | |
| Pods | |
| Tools/MaterialDesignIcons.ttf | |
| Tools/MaterialDesignIcons.json | |
| key: >- | |
| ${{ runner.os }}-pods-${{ env.DEVELOPER_DIR }}- | |
| ${{ hashFiles('**/Gemfile.lock', '**/Podfile.lock', 'Tools/BuildMaterialDesignIconsFont.sh') }} | |
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| name: "Cache: Gems" | |
| id: cache_gems | |
| with: | |
| path: vendor/bundle | |
| key: >- | |
| ${{ format('{0}-gems-{1}-{2}-{3}', | |
| runner.os, | |
| env.ImageVersion, | |
| env.DEVELOPER_DIR, | |
| hashFiles('.ruby-version', '**/Gemfile.lock')) }} | |
| - name: Install Brews | |
| # right now, we don't need anything from brew for tests, so save some time | |
| if: ${{ false }} | |
| run: brew bundle | |
| - name: Install Gems | |
| if: steps.cache_gems.outputs.cache-hit != 'true' | |
| run: bundle install --jobs 4 --retry 3 | |
| - name: Install Pods Release | |
| if: steps.cache_pods.outputs.cache-hit != 'true' | |
| run: bundle exec pod install --repo-update | |
| - name: Run tests | |
| run: bundle exec fastlane test | |
| - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| name: "Upload Code Coverage" | |
| with: | |
| xcode: true | |
| xcode_archive_path: fastlane/test_output/Tests-Unit.xcresult | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| name: "Upload Test Logs" | |
| if: ${{ always() }} | |
| with: | |
| name: test-logs | |
| path: | | |
| ~/Library/Logs/DiagnosticReports | |
| ~/Library/Developer/Xcode/DerivedData/HomeAssistant-*/Logs/Test | |
| ~/Library/Logs/scan | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| name: "Upload Simulator App" | |
| with: | |
| name: ios-simulator | |
| path: ~/Library/Developer/Xcode/DerivedData/HomeAssistant-*/Build/Products/Debug-iphonesimulator/*.app | |
| size: | |
| needs: check-swiftlint-disables | |
| if: | | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == 'home-assistant/iOS' | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | |
| with: | |
| ruby-version: .ruby-version | |
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4.6.2 | |
| name: "Cache: Pods" | |
| id: cache_pods | |
| with: | |
| path: | | |
| Pods | |
| Tools/MaterialDesignIcons.ttf | |
| Tools/MaterialDesignIcons.json | |
| key: >- | |
| ${{ runner.os }}-pods-${{ env.DEVELOPER_DIR }}- | |
| ${{ hashFiles('**/Gemfile.lock', '**/Podfile.lock', 'Tools/BuildMaterialDesignIconsFont.sh') }} | |
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| name: "Cache: Gems" | |
| id: cache_gems | |
| with: | |
| path: vendor/bundle | |
| key: >- | |
| ${{ format('{0}-gems-{1}-{2}-{3}', | |
| runner.os, | |
| env.ImageVersion, | |
| env.DEVELOPER_DIR, | |
| hashFiles('.ruby-version', '**/Gemfile.lock')) }} | |
| - name: Install Brews | |
| # right now, we don't need anything from brew for sizing, so save some time | |
| if: ${{ false }} | |
| run: brew bundle | |
| - name: Install Gems | |
| if: steps.cache_gems.outputs.cache-hit != 'true' | |
| run: bundle install --jobs 4 --retry 3 | |
| - name: Install Pods Release | |
| if: steps.cache_pods.outputs.cache-hit != 'true' | |
| run: bundle exec pod install --repo-update | |
| - name: Build app | |
| run: bundle exec fastlane ios size | |
| env: | |
| P12_KEY_DISTRIBUTION: ${{ secrets.P12_KEY_DISTRIBUTION }} | |
| P12_VALUE_DISTRIBUTION: ${{ secrets.P12_VALUE_DISTRIBUTION }} | |
| P12_KEY_MAC_DEVELOPER_ID: ${{ secrets.P12_KEY_MAC_DEVELOPER_ID }} | |
| P12_KEY_MAC_DEVELOPER_INSTALLER: ${{ secrets.P12_KEY_MAC_DEVELOPER_INSTALLER }} | |
| P12_VALUE_MAC_DEVELOPER_ID: ${{ secrets.P12_VALUE_MAC_DEVELOPER_ID }} | |
| P12_VALUE_MAC_DEVELOPER_INSTALLER: ${{ secrets.P12_VALUE_MAC_DEVELOPER_INSTALLER }} | |
| EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_TOKEN }} | |
| EMERGE_REPO_NAME: ${{ github.repository }} | |
| EMERGE_PR_NUMBER: ${{ github.event.number }} | |
| EMERGE_SHA: ${{ github.event.pull_request.head.sha }} | |
| EMERGE_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD: ${{ secrets.HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD }} | |
| HOMEASSISTANT_APPLE_ID: ${{ secrets.HOMEASSISTANT_APPLE_ID }} | |
| HOMEASSISTANT_FASTLANE_SESSION: ${{ secrets.HOMEASSISTANT_FASTLANE_SESSION }} |