Containing shared CI logic to quickly set up your repository with:
What's in it for me? Well, quite a lot! With low effort to add it to your project.
Following is a list of features which are posted in a comment on PRs based on the submitted files.
warnings
and errors
in the projectAll this is written in Swift and fully tested 🚀
These warnings are posted inline inside the PR, helping you to solve them easily.
final class
usageoverride
methods without adding logicweak
over unowned
// MARK:
usage for large files
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.
Add this repository as a submodule with the correct path Submodules/WeTransfer-iOS-CI
:
[submodule "Submodules/WeTransfer-iOS-CI"]
path = Submodules/WeTransfer-iOS-CI
url = https://github.com/WeTransfer/WeTransfer-iOS-CI.git
Create a fastlane file which executes testing with code coverage enabled. Import the Fastfile from this repo and trigger the validate_changes
lane.
import "./../Submodules/WeTransfer-iOS-CI/Fastlane/Fastfile"
desc "Run the tests and prepare for Danger"
lane :test do |options|
test_project(
project_path: "YOUR_PROJECT_PATH/",
project_name: "YOUR_PROJECT_NAME",
scheme: "YOUR_PROJECT_SCHEME")
end
Add a run script and use the common used SwiftLint script:
./Submodules/WeTransfer-iOS-CI/SwiftLint/swiftlint.sh
The shared Bitrise.yml files make it really easy to integrate CI into open-source projects. It's been optimized using this blog post for caching and triggers like:
For Danger, you need to set the DANGER_GITHUB_API_TOKEN
in your Bitrise secrets.
Make sure your Bitrise.yml looks like this:
trigger_map:
- pull_request_source_branch: "*"
workflow: wetransfer_pr_testing
workflows:
wetransfer_pr_testing:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone: {}
- script:
title: Continue from WeTransfer-iOS-CI repo
inputs:
- content: |-
#!/bin/bash
set -ex
bitrise run --config ./Bitrise/testing_bitrise.yml "${BITRISE_TRIGGERED_WORKFLOW_ID}"
Note: Don't change wetransfer_pr_testing
as this needs to match the Bitrise.yml file workflow.
By making use of the Bitrise tag triggered builds we can automate the releases of open-source projects. The automation currently performs the following steps:
Changelog.md
with the new changesAs 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?.
We 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.
After all, you're secrets should look as follows:
After that, we need to add a new trigger for tags:
trigger_map:
- pull_request_source_branch: "*"
workflow: wetransfer_pr_testing
- tag: "*"
workflow: wetransfer_tag_releasing
And we need to add the new workflow:
wetransfer_tag_releasing:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- script:
title: Force SSH
inputs:
- content: |-
#!/usr/bin/env bash
# As we work with submodules, make sure we use SSH for this config so we can push our PR later on.
# See for more info: https://discuss.bitrise.io/t/git-force-to-use-ssh-url-instead-of-https-for-github-com/4384
git config --global url."git@github.com:".insteadOf "https://github.com/"
- git-clone: {}
- script:
title: Continue from WeTransfer-iOS-CI repo
inputs:
- content: |-
#!/bin/bash
set -ex
bitrise run --config ./Submodules/WeTransfer-iOS-CI/Bitrise/tag_releasing_bitrise.yml "${BITRISE_TRIGGERED_WORKFLOW_ID}"
After that, you can simply create a new tag and the whole release process will be triggered! 🚀
WeTransfer-iOS-CI is available under the MIT license. See the LICENSE file for more info.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco