feat: add sanitization for format variable names in XcstringsParser a… #526
Workflow file for this run
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/CD | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| paths-ignore: | |
| - 'website/**' | |
| - 'README.md' | |
| - 'LICENSE' | |
| - 'CODE_OF_CONDUCT.md' | |
| - 'CONTRIBUTING.md' | |
| pull_request: | |
| branches: | |
| - 'master' | |
| env: | |
| XCODE_VERSION: '16.4' | |
| jobs: | |
| danger-swiftlint: | |
| name: Danger SwiftLint | |
| runs-on: macos-15 | |
| continue-on-error: true | |
| if: github.event_name == 'pull_request' | |
| env: | |
| DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SwiftLint and Danger Swift | |
| run: | | |
| brew install swiftlint | |
| brew install danger/tap/danger-swift | |
| - name: Run Danger SwiftLint | |
| run: danger-swift ci | |
| pod-lint: | |
| name: PodLint | |
| needs: test | |
| runs-on: macos-15 | |
| timeout-minutes: 40 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: ${{ env.XCODE_VERSION }} | |
| - name: Install CocoaPods | |
| working-directory: Example | |
| run: pod install | |
| - name: Lint pod library | |
| run: pod lib lint --skip-tests --platforms=macos,ios,tvos --allow-warnings --fail-fast | |
| spm-build: | |
| name: Build Swift Package | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| platform: [iOS, macOS, tvOS, watchOS] | |
| include: | |
| - platform: iOS | |
| destination: 'platform=iOS Simulator' | |
| - platform: macOS | |
| destination: 'platform=macOS' | |
| - platform: tvOS | |
| destination: 'platform=tvOS Simulator' | |
| - platform: watchOS | |
| destination: 'platform=watchOS Simulator' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: ${{ env.XCODE_VERSION }} | |
| - name: Install xcbeautify | |
| run: brew install xcbeautify | |
| - name: Build Package for ${{ matrix.platform }} | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| DESTINATION: ${{ matrix.destination }} | |
| run: | | |
| if [ "$PLATFORM" == "iOS" ]; then | |
| DEVICE_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries | map(select(.key | contains("iOS"))) | map(.value) | flatten | map(select(.name | contains("iPhone"))) | sort_by(.name) | last | .udid') | |
| if [ ! -z "$DEVICE_ID" ] && [ "$DEVICE_ID" != "null" ]; then | |
| DESTINATION="platform=iOS Simulator,id=$DEVICE_ID" | |
| else | |
| echo "No iOS simulator found" | |
| exit 1 | |
| fi | |
| elif [ "$PLATFORM" == "tvOS" ]; then | |
| DEVICE_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries | map(select(.key | contains("tvOS"))) | map(.value) | flatten | sort_by(.name) | last | .udid') | |
| if [ ! -z "$DEVICE_ID" ] && [ "$DEVICE_ID" != "null" ]; then | |
| DESTINATION="platform=tvOS Simulator,id=$DEVICE_ID" | |
| else | |
| echo "No tvOS simulator found" | |
| exit 1 | |
| fi | |
| elif [ "$PLATFORM" == "watchOS" ]; then | |
| DEVICE_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries | map(select(.key | contains("watchOS"))) | map(.value) | flatten | sort_by(.name) | last | .udid') | |
| if [ ! -z "$DEVICE_ID" ] && [ "$DEVICE_ID" != "null" ]; then | |
| DESTINATION="platform=watchOS Simulator,id=$DEVICE_ID" | |
| else | |
| echo "No watchOS simulator found" | |
| exit 1 | |
| fi | |
| fi | |
| xcodebuild build -scheme CrowdinSDK -destination "$DESTINATION" | xcbeautify && exit ${PIPESTATUS[0]} | |
| build: | |
| name: Build | |
| needs: spm-build | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install CocoaPods | |
| working-directory: Example | |
| run: pod install | |
| - name: Install xcbeautify | |
| run: brew install xcbeautify | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: ${{ env.XCODE_VERSION }} | |
| - name: Select Simulator | |
| id: select_sim | |
| run: | | |
| DEVICE_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries | map(select(.key | contains("iOS"))) | map(.value) | flatten | map(select(.name | contains("iPhone"))) | sort_by(.name) | last | .udid') | |
| if [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" == "null" ]; then | |
| echo "No iPhone simulator found." | |
| exit 1 | |
| fi | |
| echo "Selected Simulator UDID: $DEVICE_ID" | |
| echo "destination=platform=iOS Simulator,id=$DEVICE_ID" >> $GITHUB_OUTPUT | |
| - name: Build | |
| working-directory: Example | |
| run: | | |
| xcodebuild build \ | |
| -workspace ./AppleReminders.xcworkspace \ | |
| -scheme AppleReminders \ | |
| -configuration Debug \ | |
| -destination '${{ steps.select_sim.outputs.destination }}' | xcbeautify && exit ${PIPESTATUS[0]} | |
| # TODO: ObjCExample | |
| test: | |
| name: Test | |
| needs: build | |
| runs-on: macos-15 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache CocoaPods | |
| uses: actions/cache@v4 | |
| with: | |
| path: Tests/Pods | |
| key: ${{ runner.os }}-pods-tests-${{ hashFiles('Tests/Podfile.lock') }} | |
| - name: Cache Xcode Derived Data | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/Library/Developer/Xcode/DerivedData | |
| key: ${{ runner.os }}-xcode-derived-${{ hashFiles('Tests/**/*.swift', 'Tests/**/*.m', 'Tests/**/*.h') }} | |
| - name: Install CocoaPods | |
| working-directory: Tests | |
| run: pod install | |
| - name: Install xcbeautify | |
| run: brew install xcbeautify | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: ${{ env.XCODE_VERSION }} | |
| - name: Select Simulator | |
| id: select_sim | |
| run: | | |
| DEVICE_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries | map(select(.key | contains("iOS"))) | map(.value) | flatten | map(select(.name | contains("iPhone"))) | sort_by(.name) | last | .udid') | |
| if [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" == "null" ]; then | |
| echo "No iPhone simulator found. Listing all devices:" | |
| xcrun simctl list devices | |
| exit 1 | |
| fi | |
| echo "Selected Simulator UDID: $DEVICE_ID" | |
| echo "destination=platform=iOS Simulator,id=$DEVICE_ID" >> $GITHUB_OUTPUT | |
| - name: Tests | |
| working-directory: Tests | |
| env: | |
| RUN_INTEGRATION_TESTS: "0" | |
| run: | | |
| xcodebuild test \ | |
| -sdk iphonesimulator \ | |
| -workspace ./Tests.xcworkspace \ | |
| -scheme Tests \ | |
| -configuration Debug \ | |
| -destination '${{ steps.select_sim.outputs.destination }}' \ | |
| -parallel-testing-enabled NO \ | |
| -enableCodeCoverage YES | xcbeautify && exit ${PIPESTATUS[0]} | |
| - name: Upload coverage to Codecov | |
| run: cd Tests & bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} |