diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 276fab0..e82511d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,19 +16,21 @@ jobs: build: runs-on: macos-latest timeout-minutes: 40 + env: + DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer" steps: - uses: actions/checkout@v4 - name: archive run: | xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug - - name: ipa + - name: upload testflight env: AUTHKEY_P8_BASE64: ${{ secrets.AUTHKEY_P8_BASE64 }} ISSUER_ID: ${{ secrets.ISSUER_ID }} KEY_ID: ${{ secrets.KEY_ID }} run: | echo $AUTHKEY_P8_BASE64 | base64 -d > $PWD/Authkey.p8 - xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptions.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8 + xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptionsTestFlight.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8 test: runs-on: macos-latest diff --git a/ExportOptionsTestFlight.plist b/ExportOptionsTestFlight.plist new file mode 100644 index 0000000..eacaf36 --- /dev/null +++ b/ExportOptionsTestFlight.plist @@ -0,0 +1,25 @@ + + + + + destination + upload + manageAppVersionAndBuildNumber + + method + app-store-connect + provisioningProfiles + + com.tarappo.uitest + UI Test Sample + + signingStyle + automatic + stripSwiftSymbols + + teamID + BY773RCU69 + uploadSymbols + + + diff --git a/README.md b/README.md index f981bd7..8d88f10 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,17 @@ mainは常に問題ないコードが入っている前提です。 - 特定タイミングになったらtagをきってリリース +# CI/CDサービスごとの実行内容 +すべてのCI/CDサービスでTest Flightへのアップロードをおこなうのは微妙なので次のように分けています。 + +|CI/CDサービス|トリガー|内容| +|:----------|:------|:---| +|GitHub Actions|PR|TestFlightへアップロード| +|CircleCI|PR|アプリのビルドと保存| +|Bitrise|PR|アプリのビルドと保存| + + + ## CI Badge Badgeが利用できるCIサービスについては以下に全て貼ります。 diff --git a/bitrise.yml b/bitrise.yml new file mode 100644 index 0000000..91f57a0 --- /dev/null +++ b/bitrise.yml @@ -0,0 +1,67 @@ +format_version: "13" +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: ios +workflows: + build: + summary: Run your Xcode tests and create an IPA file to install your app on a device or share it with your team. + description: The workflow will first clone your Git repository, cache and install your project's dependencies if any, run your Xcode tests, export an IPA file from the project and save it. + steps: + - git-clone@8: {} + - cache-pull@2: {} + - script@1: + inputs: + - script_file_path: null + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug + title: Archiveの作成 + - script@1: + inputs: + - script_file_path: null + - content: | + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + echo "${AUTHKEY_P8_BASE64}" | base64 -d > $PWD/Authkey.p8 + + xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./output -exportOptionsPlist ./ExportOptions.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8 + title: Archiveからipaを生成 + - cache-push@2: {} + - deploy-to-bitrise-io@2: + inputs: + - deploy_path: ./output +meta: + bitrise.io: + stack: osx-xcode-15.4.x + machine_type_id: g2-m1.4core +app: + envs: + - opts: + is_expand: false + BITRISE_PROJECT_PATH: ci-sample.xcworkspace + - opts: + is_expand: false + BITRISE_SCHEME: ci-sample + - opts: + is_expand: false + BITRISE_DISTRIBUTION_METHOD: ad-hoc +trigger_map: +- pull_request_target_branch: + regex: main + type: pull_request + workflow: build +- push_branch: main + type: push + workflow: build diff --git a/ci-sample/Info.plist b/ci-sample/Info.plist index 6d915c8..f8eec6a 100644 --- a/ci-sample/Info.plist +++ b/ci-sample/Info.plist @@ -32,5 +32,7 @@ UIInterfaceOrientationPortrait + ITSAppUsesNonExemptEncryption + diff --git a/fastlane/Deliverfile b/fastlane/Deliverfile deleted file mode 100644 index 57a798c..0000000 --- a/fastlane/Deliverfile +++ /dev/null @@ -1,7 +0,0 @@ -# The Deliverfile allows you to store various App Store Connect metadata -# For more information, check out the docs -# https://docs.fastlane.tools/actions/deliver/ - -release_notes({ - 'default' => "Sample Release Note" -}) \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f20a855..dae896e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,16 +1,37 @@ +skip_docs +opt_out_usage + default_platform :ios platform :ios do - keychain_name = "ios-build.keychain" - keychain_password = SecureRandom.base64 - build_number = ENV["BUILD_NUMBER"] ||= "0" - + desc "run test" lane :test do run_tests( output_directory: "./test_result" ) end + + lane :upload_ipa_for_testflight do + key_id = ENV["KEY_ID"] + issuer_id = ENV["ISSUER_ID"] + ipa_file_path = ENV["IPA_FILE_PATH"] + auth_key_p8_path = ENV["AUTHKEY_P8_FILE_PATH"] + + app_store_connect_api_key( + key_id: key_id, + issuer_id: issuer_id, + key_filepath: auth_key_p8_path, + duration: 1200, + in_house: false + ) + + upload_to_testflight( + ipa: ipa_file_path, + skip_submission: true, + ) + end + desc "build Simulator File" lane :build_for_simulator do build_app( @@ -24,47 +45,4 @@ platform :ios do end - lane :build_debug_without_match do - clean_build_artifacts - increment_build_number( - build_number: "0." + ENV["BUILD_NUMBER"] - ) - - build(type: "Debug") - end - - lane :build_debug do - match(type: "development", readonly: is_ci) - - clean_build_artifacts - increment_build_number( - build_number: "0." + ENV["BUILD_NUMBER"] - ) - - build(type: "Debug") - end - - lane :build_release do - match(type: "appstore", readonly: is_ci) - - clean_build_artifacts - increment_build_number( - build_number: "1." + ENV["BUILD_NUMBER"] - ) - - build(type: "Release") - end - - - private_lane :build do |options| - configuration = options[:type] - export_method = configuration == "Release" ? "appstore" : "development" - - gym( - project: "./ci-sample.xcodeproj", - scheme: "ci-sample", - configuration: configuration, - export_method: export_method - ) - end end diff --git a/fastlane/Matchfile b/fastlane/Matchfile deleted file mode 100644 index eb9e987..0000000 --- a/fastlane/Matchfile +++ /dev/null @@ -1,4 +0,0 @@ -git_url(ENV['MATCH_URL']) - -storage_mode("git") -app_identifier(["com.tarappo.cisample"]) diff --git a/fastlane/metadata/copyright.txt b/fastlane/metadata/copyright.txt deleted file mode 100644 index 4c890d1..0000000 --- a/fastlane/metadata/copyright.txt +++ /dev/null @@ -1 +0,0 @@ -2019 tarappo diff --git a/fastlane/metadata/en-US/description.txt b/fastlane/metadata/en-US/description.txt deleted file mode 100644 index 51922ff..0000000 --- a/fastlane/metadata/en-US/description.txt +++ /dev/null @@ -1,2 +0,0 @@ -This application is sample. -so do not release. diff --git a/fastlane/metadata/en-US/keywords.txt b/fastlane/metadata/en-US/keywords.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/keywords.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/marketing_url.txt b/fastlane/metadata/en-US/marketing_url.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/marketing_url.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/name.txt b/fastlane/metadata/en-US/name.txt deleted file mode 100644 index b976c12..0000000 --- a/fastlane/metadata/en-US/name.txt +++ /dev/null @@ -1 +0,0 @@ -CICD - SampleApp diff --git a/fastlane/metadata/en-US/privacy_url.txt b/fastlane/metadata/en-US/privacy_url.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/privacy_url.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/promotional_text.txt b/fastlane/metadata/en-US/promotional_text.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/promotional_text.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/release_notes.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/subtitle.txt b/fastlane/metadata/en-US/subtitle.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/subtitle.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/en-US/support_url.txt b/fastlane/metadata/en-US/support_url.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/en-US/support_url.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/primary_category.txt b/fastlane/metadata/primary_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/primary_category.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/primary_first_sub_category.txt b/fastlane/metadata/primary_first_sub_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/primary_first_sub_category.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/primary_second_sub_category.txt b/fastlane/metadata/primary_second_sub_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/primary_second_sub_category.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/demo_password.txt b/fastlane/metadata/review_information/demo_password.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/demo_password.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/demo_user.txt b/fastlane/metadata/review_information/demo_user.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/demo_user.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/email_address.txt b/fastlane/metadata/review_information/email_address.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/email_address.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/first_name.txt b/fastlane/metadata/review_information/first_name.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/first_name.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/last_name.txt b/fastlane/metadata/review_information/last_name.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/last_name.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/notes.txt b/fastlane/metadata/review_information/notes.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/notes.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/review_information/phone_number.txt b/fastlane/metadata/review_information/phone_number.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/review_information/phone_number.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/secondary_category.txt b/fastlane/metadata/secondary_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/secondary_category.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/secondary_first_sub_category.txt b/fastlane/metadata/secondary_first_sub_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/secondary_first_sub_category.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fastlane/metadata/secondary_second_sub_category.txt b/fastlane/metadata/secondary_second_sub_category.txt deleted file mode 100644 index 8b13789..0000000 --- a/fastlane/metadata/secondary_second_sub_category.txt +++ /dev/null @@ -1 +0,0 @@ -