xcode.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: Build main target
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - develop
  7. pull_request:
  8. types: [synchronize, opened, reopened, ready_for_review]
  9. branches:
  10. - master
  11. - develop
  12. jobs:
  13. build-and-test:
  14. name: Build and Test
  15. runs-on: macOS-latest
  16. if: github.event.pull_request.draft == false
  17. env:
  18. PROJECT: Nextcloud.xcodeproj
  19. DESTINATION: platform=iOS Simulator,name=iPhone 14
  20. SCHEME: Nextcloud
  21. steps:
  22. - name: Set env var
  23. run: echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV
  24. - uses: actions/checkout@v3
  25. - name: Setup Bundler and Install Gems
  26. run: |
  27. gem install bundler
  28. bundle install
  29. bundle update
  30. - name: Restore Carhage Cache
  31. uses: actions/cache@v3
  32. id: carthage-cache
  33. with:
  34. path: Carthage
  35. key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
  36. restore-keys: |
  37. ${{ runner.os }}-carthage-
  38. - name: Carthage
  39. if: steps.carthage-cache.outputs.cache-hit != 'true'
  40. run: carthage bootstrap --use-xcframeworks --platform iOS
  41. - name: Download GoogleService-Info.plist
  42. run: wget "https://raw.githubusercontent.com/firebase/quickstart-ios/master/mock-GoogleService-Info.plist" -O GoogleService-Info.plist
  43. - name: Install docker
  44. run: |
  45. # Workaround for https://github.com/actions/runner-images/issues/8104
  46. brew remove --ignore-dependencies qemu
  47. curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/dc0669eca9479e9eeb495397ba3a7480aaa45c2e/Formula/qemu.rb
  48. brew install ./qemu.rb
  49. brew install docker
  50. colima start
  51. - name: Create docker test server and export enviroment variables
  52. run: |
  53. source ./create-docker-test-server.sh
  54. if [ ! -f ".env-vars" ]; then
  55. touch .env-vars
  56. echo "export TEST_SERVER_URL=$TEST_SERVER_URL" >> .env-vars
  57. echo "export TEST_USER=$TEST_USER" >> .env-vars
  58. echo "export TEST_APP_PASSWORD=$TEST_APP_PASSWORD" >> .env-vars
  59. fi
  60. - name: Build & Test Nextcloud iOS
  61. run: |
  62. set -o pipefail && xcodebuild test -project $PROJECT \
  63. -scheme "$SCHEME" \
  64. -destination "$DESTINATION" \
  65. -enableCodeCoverage YES \
  66. -test-iterations 3 \
  67. -retry-tests-on-failure \
  68. | xcpretty
  69. - name: Upload coverage to codecov
  70. run: |
  71. bundle exec slather
  72. bash <(curl -s https://codecov.io/bash) -f ./cobertura.xml -X coveragepy -X gcov -X xcode -t ${{ secrets.CODECOV_TOKEN }}