Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap Travis configuration with Circle #278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion defaults/liftoffrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ run_script_phases:
name: Set version number

templates:
- travis.yml: .travis.yml
- circle.yml: .circle.yml
- test.sh: bin/test
- setup.sh: bin/setup
- README.md: README.md
Expand Down
14 changes: 7 additions & 7 deletions man/liftoffrc.5
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ meaning.
.Ic liftoff
installs a number of templates by default:
.Bl -tag -width 10
.It Pa travis.yml
.It Pa circle.yml
This template is installed to
.Pa .travis.yml ,
and contains a default setup for Travis integration.
.Pa circle.yml ,
and contains a default setup for CircleCI integration.
.It Pa Gemfile.rb
This template is installed to
.Pa Gemfile ,
Expand All @@ -502,21 +502,21 @@ This template is installed to
.Pa bin/test
and enables the running of tests from the command line. This is used by the
default
.Pa travis.yml
.Pa circle.yml
template to determine build status.
.El
.Pp
.Ic liftoff
expects templates in the following format:
.Pp
.Bd -literal
- travis.yml: .travis.yml
- circle.yml: circle.yml
.Ed
.Pp
This will install the template named
.Pa travis.yml
.Pa circle.yml
found inside the templates directory to
.Pa .travis.yml
.Pa circle.yml
inside the project directory.
.Pp
This file will be parsed with ERB with the project configuration, giving you
Expand Down
7 changes: 7 additions & 0 deletions templates/circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
machine:
xcode:
version: "7.3"

test:
override:
- bin/test -r
46 changes: 43 additions & 3 deletions templates/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
#!/usr/bin/env bash
#!/bin/bash
#
# Runs tests via xcodebuild, formatting results with xcpretty.
#
# Usage: bin/test [options]
#
# Options:
# -k Clean before running the tests.
# -r Emit JUnit XML report.
# -t Use RSpec-style test output.

set -o pipefail
set -eo pipefail

xcodebuild test -workspace <%= project_name %>.xcworkspace -scheme <%= project_name %> -sdk iphonesimulator BUILD_ACTIVE_ARCH=NO | xcpretty -t -c
build_actions=(test)
test_reports_dir="${CIRCLE_TEST_REPORTS:-build}"
xcpretty_options=(--color)

while getopts krt opt; do
case ${opt} in
k)
build_actions=(clean test)
;;
r)
xcpretty_options+=(--report junit --output "${test_reports_dir}/test-report.xml")
;;
t)
xcpretty_options+=(--test)
;;
*)
exit 1
;;
esac
done

shift $((OPTIND - 1))

mkdir -p "${test_reports_dir}"

env NSUnbufferedIO=YES xcrun xcodebuild \
-workspace <%= project_name %>.xcworkspace \
-scheme <%= project_name %> \
-sdk iphonesimulator \
BUILD_ACTIVE_ARCH=NO \
"${build_actions[@]}" \
| xcpretty "${xcpretty_options[@]}"