{"id":13990694,"url":"https://github.com/WeTransfer/WeTransfer-iOS-CI","last_synced_at":"2025-07-22T13:30:58.520Z","repository":{"id":38094322,"uuid":"126338436","full_name":"WeTransfer/WeTransfer-iOS-CI","owner":"WeTransfer","description":"Containing all the shared CI logic for WeTransfer repositories","archived":false,"fork":false,"pushed_at":"2025-01-13T10:36:26.000Z","size":25149,"stargazers_count":227,"open_issues_count":5,"forks_count":15,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-28T09:11:26.925Z","etag":null,"topics":["wt-branch-protection-exempt","wt-branch-protection-two-approvals"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WeTransfer.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-22T13:21:36.000Z","updated_at":"2025-06-03T07:35:58.000Z","dependencies_parsed_at":"2023-01-29T04:16:01.328Z","dependency_job_id":"d1958bcd-5792-4406-99fb-fbf6260c2130","html_url":"https://github.com/WeTransfer/WeTransfer-iOS-CI","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/WeTransfer/WeTransfer-iOS-CI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FWeTransfer-iOS-CI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FWeTransfer-iOS-CI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FWeTransfer-iOS-CI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FWeTransfer-iOS-CI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeTransfer","download_url":"https://codeload.github.com/WeTransfer/WeTransfer-iOS-CI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FWeTransfer-iOS-CI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266505784,"owners_count":23940019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wt-branch-protection-exempt","wt-branch-protection-two-approvals"],"created_at":"2024-08-09T13:03:07.261Z","updated_at":"2025-07-22T13:30:58.046Z","avatar_url":"https://github.com/WeTransfer.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# WeTransfer-iOS-CI\n![Build Status](https://app.bitrise.io/app/9829cbc3cc6501a3.svg?token=hCyPPIJ1MV2h0xyX1Ux4kA)\n\nContaining shared CI logic to quickly set up your repository with:\n\n- Tests running for each pull request\n- Danger reports for each pull request\n\n# Why should I use it?\nWhat's in it for me? Well, quite a lot! With low effort to add it to your project.\n\n- Integrate [SwiftLint](https://github.com/realm/SwiftLint) to lint source code and tests\n- Integrate [Fastlane](https://github.com/fastlane/fastlane) to run tests for PRs\n- Integrate [Danger](http://danger.systems/) to automatically improve PR reviews\n- Easily add automated releases based on tag-triggers\n\n## Danger features\nFollowing is a list of features which are posted in a comment on PRs based on the submitted files.\n\n  - Warn for big PRs, containing more than 500 lines of code\n  - Warn for missing PR description\n  - Warn for missing updated tests\n  - Show code coverage of PR related files\n  - Show any failed tests\n  - Show all `warnings` and `errors` in the project\n  - Show slowest tests\n\nAll this is written in Swift and fully tested 🚀\n\n### Custom linting\nThese warnings are posted inline inside the PR, helping you to solve them easily.\n\n  - Check for `final class` usage\n  - `override` methods without adding logic\n  -  Suggest `weak` over `unowned`\n  -  Suggest `// MARK:` usage for large files\n\n![](Assets/danger_comment.png)\n_This is an example comment. Note that `WeTransferBot` will be replaced by your own bot. More info can be found here: [Getting started with Danger](http://danger.systems/guides/getting_started.html)._\n\n### Adjusting slowests tests\nThe following environment variables can be used to adjust the slowest tests outcomes:\n- Use `SLOW_TESTS_DURATION_THRESHOLD` to configure a minimum duration threshold before a slow test shows up. Defaults to `2`.\n- Use `SLOW_TESTS_LIMIT` to configure the limit of slow tests to be shown. Defaults to `3`.\n\n# How to integrate?\n\n### 1: Add submodule\nAdd this repository as a submodule with the correct path `Submodules/WeTransfer-iOS-CI`:\n\n```\n[submodule \"Submodules/WeTransfer-iOS-CI\"]\n\tpath = Submodules/WeTransfer-iOS-CI\n\turl = https://github.com/WeTransfer/WeTransfer-iOS-CI.git\n```\n\n### 2: Create a fastlane file\n\nCreate a fastlane file which executes testing with code coverage enabled. Import the Fastfile from this repo and trigger the `test` lane.\n\n```ruby\nimport \"./../Submodules/WeTransfer-iOS-CI/Fastlane/Fastfile\"\nimport \"./../Submodules/WeTransfer-iOS-CI/Fastlane/shared_lanes.rb\"\n\ndesc \"Run the tests and prepare for Danger\"\nlane :test do |options|\n  test_project(\n    project_path: \"YOUR_PROJECT_PATH/\",\n    project_name: \"YOUR_PROJECT_NAME\",\n    scheme: \"YOUR_PROJECT_SCHEME\")\nend\n\n```\n\n### 3: Integrate SwiftLint in your project\nAdd a run script and use the common used [SwiftLint](https://github.com/WeTransfer/WeTransfer-iOS-CI/blob/master/BuildTools/swiftlint.sh) script:\n\n```shell\n./Submodules/WeTransfer-iOS-CI/BuildTools/swiftlint.sh\n```\n\n### 4: Make use of the shared Bitrise.yml workflows\nThe shared Bitrise.yml files make it really easy to integrate CI into open-source projects. It's been optimized using [this](https://blog.bitrise.io/tune-your-bitrise-workflows-using-cache-in-steps) blog post for caching and triggers like:\n\n- Manage gems \u0026 brews\n- Cache pulling\n- Run fastlane for testing\n- Run Danger from this repo\n- Cache pushing\n\n#### How to use this in your Bitrise configuration?\nFor Danger, you need to set the `DANGER_GITHUB_API_TOKEN` in your Bitrise secrets.\n\nMake sure your Bitrise.yml looks like this:\n\n```yml\ntrigger_map:\n- pull_request_source_branch: \"*\"\n  workflow: wetransfer_pr_testing\nworkflows:\n  wetransfer_pr_testing:\n    steps:\n    - activate-ssh-key:\n        run_if: '{{getenv \"SSH_RSA_PRIVATE_KEY\" | ne \"\"}}'\n    - git-clone: {}\n    - script:\n        title: Continue from WeTransfer-iOS-CI repo\n        inputs:\n        - content: |-\n            #!/bin/bash\n            set -ex\n            bitrise run --config ./Bitrise/testing_bitrise.yml \"${BITRISE_TRIGGERED_WORKFLOW_ID}\"\n```\n\n_Note: Don't change `wetransfer_pr_testing` as this needs to match the Bitrise.yml file workflow._\n\n### 5: Add automated releases based on tags\nBy making use of the Bitrise tag triggered builds we can automate the releases of open-source projects. The automation currently performs the following steps:\n\n- Automatically fetch the changelog using the [ChangelogProducer](https://github.com/WeTransfer/ChangelogProducer)\n- Create a GitHub release containing the changelog\n- Update and push the podspec\n- Update the `Changelog.md` with the new changes\n- Create a release branch and open a PR for those changes\n\n#### How to use this in your Bitrise configuration?\nAs open-source projects are making use of HTTPS by default we need to force Bitrise to use SSH instead. Therefore, we need to add the SSH key manually to the secret environment variables with the key `SSH_RSA_PRIVATE_KEY`. You can can read more about this here: [How can I generate an SSH key pair?](https://devcenter.bitrise.io/faq/how-to-generate-ssh-keypair/).\n\nWe also need to create a environment secret for CocoaPods trunk pushes with the key `COCOAPODS_TRUNK_TOKEN`. How to do that is explained here: [Automated CocoaPod releases with CI](https://fuller.li/posts/automated-cocoapods-releases-with-ci/).\n\nAfter all, you're secrets should look as follows:\n\n![](Assets/bitrise_env_vars.png)\n\nAfter that, we need to add a new trigger for tags:\n\n```yaml\ntrigger_map:\n- pull_request_source_branch: \"*\"\n  workflow: wetransfer_pr_testing\n- tag: \"*\"\n  workflow: wetransfer_tag_releasing\n```\n\nAnd we need to add the new workflow:\n\n```yaml\nwetransfer_tag_releasing:\nsteps:\n- activate-ssh-key:\n    run_if: '{{getenv \"SSH_RSA_PRIVATE_KEY\" | ne \"\"}}'\n- script:\n    title: Force SSH\n    inputs:\n    - content: |-\n        #!/usr/bin/env bash\n        # As we work with submodules, make sure we use SSH for this config so we can push our PR later on.\n        # See for more info: https://discuss.bitrise.io/t/git-force-to-use-ssh-url-instead-of-https-for-github-com/4384\n        git config --global url.\"git@github.com:\".insteadOf \"https://github.com/\"\n- git-clone: {}\n- script:\n    title: Continue from WeTransfer-iOS-CI repo\n    inputs:\n    - content: |-\n        #!/bin/bash\n        set -ex\n        bitrise run --config ./Submodules/WeTransfer-iOS-CI/Bitrise/tag_releasing_bitrise.yml \"${BITRISE_TRIGGERED_WORKFLOW_ID}\"\n```\n\nAfter that, you can simply create a new tag and the whole release process will be triggered! 🚀\n\n### 6: App deployment lanes\nIf you are building an app instead of a framework you can make use of the deployment lanes.\n\nThe `beta` lane takes care of:\n- Generating a changelog based on the GH issues that were solved and PR's that were merged in since the last beta build.\n- Create a draft release in GitHub.\n- Create a new AppStore release candidate and upload it to TestFlight.\n\nThe `release` does the following:\n- Fetch the lates green (approved) release from GitHub.\n- Create a new release branch in GitHub.\n- Create a PR that merges the release branch into the main branch.\n- Create a PR that merges the release branch into develop in order to make sure that develop contains the updated changelog and incremented build number.\n- Create a release build, upload it to TestFlight and submit for review.\n\nThese two lanes allow for the following workflow:\n1. Use the `beta` lane to upload an AppStore Release Candidate to TestFlight.\n2. Once the build went trough QA and has been approved for release mark it as green.\n3. Submit a new build to the App Store using the `release` lane.\n\n#### Marking a build as release ready\n- Find the draft release matching the tested TestFlight build number at `http://github.com/{organization}/{repo}/releases`.\n- Edit the draft and press the green button `Publish release`.\n\n#### How to use this in your project?\n\nImport the `deployment_lanes.rb` from this repo into the Fastfile. If you haven't done so already in step 2 also import the `shared_lanes` file.\n\n```ruby\nimport \"./../Submodules/WeTransfer-iOS-CI/Fastlane/deployment_lanes.rb\"\n```\n\nThen you need to make sure to authenticate with App Store Connect before running the deployment lanes. This can be done by adding a `before_all` block, like so:\n\n```ruby\nbefore_all do |lane, options|\n  authenticate\nend\n```\n\nThen there is two ways you can start using the deployment lanes. The first one is to create a new lane in the Fastfile from which you call one of the deployment lanes specifying values for all the options. The other option is to use environment variables, for example by using a .env file. In that case the lanes can be called directly without passing any options. An example of a .env file can be found [here](sample_fastlane_env).\n\n### 7: Provisioning lanes\n\nThe provisioning lanes help you with provisioning related task such as code signing and device management. To use them all you need to do is import `provisioning_lanes.rb` from this repo into the Fastfile.\n\n## Running Bitrise locally\nMake sure to have your `Bitrise.yml` locally inside your repo and then just run `bitrise run \u003cworkflow_local\u003e` after adding the following local testing workflow:\n\n```yaml\n  \u003cworkflow_name\u003e_local:\n    steps:\n    - script:\n        title: Setup environment variables\n        inputs:\n        - content: |-\n            #!/bin/bash\n            # Change these for your current local session.\n            export BITRISE_IO=\"fake_bitrise\"\n            export BITRISEIO_GIT_REPOSITORY_OWNER=\"WeTransfer\"                                                                                       \n            export BITRISEIO_GIT_REPOSITORY_SLUG=\"WeTransfer-iOS-SDK\"                                                                                \n            export BITRISE_PULL_REQUEST=452                                                                                                          \n\n            bitrise run \u003cworkflow_name\u003e\n```\n\nDoing so allows you to run Bitrise workflows locally which will even update the Danger messages in GitHub itself. It kind of mimics [this](https://github.com/danger/danger-js/blob/fe5f080b4a267012dd80a9d589faee3bd278dc18/source/ci_source/providers/Bitrise.ts) Bitrise representation using env variables.\n\n\n## Bitrise Key-Based caching\nKey-based caching uses checksums. To test out a checksum locally, use `find . -print | grep -i */Package.resolved`. For example, that could result in:\n\n```yaml\n- key: spm-cache-{{ checksum \"Package.resolved\" \"*.xcodeproj/**/Package.resolved\" \"WeTransferPRLinter/Package.resolved\" }}\n```\n\n### Decompress caches\nIf you want to decompress a `tzst` cache file after downloading it from Bitrise, you can use the following command:\n\n```bash\n% tar -xvf /path/to/cache-20221110-112409.tzst \n```\n\n## Danger Binary Updating\n- See https://github.com/danger/swift/issues/476\n- Fork https://github.com/danger/swift\n- Update Danger's Package.swift to Swift 5.9 and switch `isDevelop` to `false`\n- Run `swift build --configuration release --arch arm64 --arch x86_64`\n- Copy the file from `.build/apple/Products/Release/danger-swift` to the root of the repository\n\n## License\nWeTransfer-iOS-CI is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeTransfer%2FWeTransfer-iOS-CI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWeTransfer%2FWeTransfer-iOS-CI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeTransfer%2FWeTransfer-iOS-CI/lists"}