GitHub actions to build and test iOS projects using Fastlane

name: "Build and Test"on: 
push:
branches:
- development
- beta
pull_request:
jobs:
build_test:
name: Run tests
runs-on: macOS-11
env:
XCODE_VERSION: "13.0"
steps:
- name: Select XCode
# Use XCODE_VERSION env variable to set the XCode version you want.
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Checkout
uses: actions/checkout@v2

- name: Run tests
run: |
set -o pipefail
fastlane tests
default_platform :iosplatform :ios do
####### Testing #######
desc "Runs all the tests"
lane :tests do
unit_tests
end
desc "Runs all unit tests"
lane :unit_tests do
scan(
workspace: "MyAmazingApp.xcworkspace",
scheme: "MyAmazingAppTests",
devices: ["iPhone 8"]
)
end
desc "Runs all ui tests"
lane :ui_tests do
scan(
workspace: "MyAmazingApp.xcworkspace",
scheme: "MyAmazingAppTests",
devices: ["iPhone 8"],
clean: true
)
end
end
on: 
push:
branches:
- development
- beta
pull_request:
jobs:
build_test:
name: Run tests
runs-on: macOS-11
env:
# The XCode version to use. If you want to update it please refer to this document:
# https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software
# and set proper version.
XCODE_VERSION: "13.0"
steps:
- name: Select XCode
# Use XCODE_VERSION env variable to set the XCode version you want.
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Checkout
uses: actions/checkout@v2

- name: Run tests
run: |
set -o pipefail
fastlane tests

--

--

--

Lead iOS Developer at Somnox B.V. Netherlands, 23 years old, loves esports, portfolio https://www.hoyelam.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Swift Tips — Passing data between View Controllers while popping Second View Controller

Seven things you should know before starting with Flutter Web

Part 7: Swift Tricks That Junior iOS Developers Might not Know

Swift Closures: Escaping Explained

How to Use Lottie Animations in SwiftUI

Data Structure Stack in Swift

Create the Perfect UserDefaults Wrapper Using Property Wrapper

Build a Custom iOS Segmented Control With SwiftUI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hoye Lam

Hoye Lam

Lead iOS Developer at Somnox B.V. Netherlands, 23 years old, loves esports, portfolio https://www.hoyelam.com

More from Medium

iOS Apps CI/CD pipeline with GitHub Actions and Fastlane

Continuously Building and Hosting our Swift DocC Documentation using Github Actions and Netlify

iOS CI/CD Experiments: GitLab (Runner) + Fastlane + SwiftLint

RESULT BUILDERS AND DSL — X — FILE