照片 #11
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: iOS CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ios-ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| ios-ci: | |
| runs-on: macos-15 | |
| timeout-minutes: 45 | |
| env: | |
| CI: true | |
| NODE_VERSION: 22.13.0 | |
| XCODE_MAJOR_VERSION: "26" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.6.10 | |
| bundler-cache: true | |
| - name: Select Xcode ${{ env.XCODE_MAJOR_VERSION }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| candidates=(/Applications/Xcode_${XCODE_MAJOR_VERSION}*.app) | |
| if (( ${#candidates[@]} == 0 )); then | |
| echo "No Xcode ${XCODE_MAJOR_VERSION}.x installation found on this runner." >&2 | |
| ls -1 /Applications | grep '^Xcode' >&2 || true | |
| exit 1 | |
| fi | |
| selected_app="$( | |
| printf '%s\n' "${candidates[@]}" \ | |
| | ruby -e 'apps = STDIN.read.lines.map(&:strip).reject(&:empty?); abort("No Xcode candidates found") if apps.empty?; puts apps.max_by { |path| Gem::Version.new(File.basename(path).sub(/^Xcode_/, "").sub(/\.app$/, "")) }' | |
| )" | |
| developer_dir="${selected_app}/Contents/Developer" | |
| echo "DEVELOPER_DIR=${developer_dir}" >> "${GITHUB_ENV}" | |
| "${developer_dir}/usr/bin/xcodebuild" -version | |
| "${developer_dir}/usr/bin/xcodebuild" -showsdks | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Run unit tests | |
| run: npm test -- --runInBand | |
| - name: Install CocoaPods dependencies | |
| run: bundle exec pod install --project-directory=ios | |
| - name: Build iOS app for simulator | |
| shell: bash | |
| run: | | |
| set -o pipefail | |
| xcodebuild \ | |
| -workspace ios/FileFlashBridge.xcworkspace \ | |
| -scheme FileFlashBridge \ | |
| -configuration Debug \ | |
| -sdk iphonesimulator \ | |
| -destination 'generic/platform=iOS Simulator' \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| COMPILER_INDEX_STORE_ENABLE=NO \ | |
| build | tee xcodebuild.log | |
| - name: Upload xcodebuild log | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: xcodebuild-log | |
| path: xcodebuild.log |