diff --git a/.travis.yml b/.travis.yml index 728c612..04d32b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,35 @@ -matrix: +language: swift +os: osx +git: + depth: 1 +cache: + directories: + - /usr/local/Homebrew + - $HOME/Library/Caches/Homebrew + +jobs: include: - - os: osx + - stage: Test go packages + language: go + before_install: brew update + install: brew list --versions go | grep "1\.11.*" || brew upgrade go@1.11 + script: make test-go + + - stage: Test relax commands osx_image: xcode8 - - os: osx + script: test/travis_ci.sh + + - stage: Test relax commands osx_image: xcode8.3 - - os: osx + script: test/travis_ci.sh + + - stage: Test relax commands osx_image: xcode9.4 - - os: osx - osx_image: xcode10 + script: test/travis_ci.sh -script: - - test/travis_ci.sh + - stage: Test relax commands + osx_image: xcode10 + script: test/travis_ci.sh env: global: diff --git a/Makefile b/Makefile index ef00783..d7bad55 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ .PHONY: test test: bats - @PATH="/bin:$$PWD/bats/bin:$$PWD/bin:$$PATH" test/run.sh ${keychain} + @PATH="$$PWD/bats/bin:$$PWD/bin:$$PATH" test/run.sh + +.PHONY: test-go +test-go: + @PATH="$$PWD/bin:$$PATH" test/go.sh version: @PATH="$$PWD/bin:$$PATH" relax --version diff --git a/README.md b/README.md index b11e8eb..317c5c2 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ NOTE: You need to create a provisioning profile for your identity(certificate) and install them to a build machine by yourself because Relax doesn't access to Apple Developer Center for security reasons. -But **`relax profile add` and `relax keychain add` help you to install them and resolve permissions for your identities in your keychain. I highly recommend to use those commands**. See [here](https://github.com/SCENEE/relax/blob/master/test/run.sh#L31) and [here](https://github.com/SCENEE/relax/blob/master/test/run.sh#L43). +But **`relax profile add` and `relax keychain add` help you to install them and resolve permissions for your identities in your keychain. I highly recommend to use those commands**. See [here](https://github.com/SCENEE/relax/blob/master/test/setup.sh#L22) and [here](https://github.com/SCENEE/relax/blob/master/test/setup.sh#L33). # Installation diff --git a/go/bin/relparser b/go/bin/relparser index b853d19..17d2ec3 100755 Binary files a/go/bin/relparser and b/go/bin/relparser differ diff --git a/go/src/relparser/relfile/distribution_test.go b/go/src/relparser/relfile/distribution_test.go index ae641b8..20c3a28 100644 --- a/go/src/relparser/relfile/distribution_test.go +++ b/go/src/relparser/relfile/distribution_test.go @@ -14,4 +14,9 @@ func TestCheck(t *testing.T) { //infopath := "../../../../sample/SampleApp/Info.plist" //d.Check(infopath) d.Check() + + if !d.ExportOptions.CompileBitcode && !d.ExportOptions.UploadBitcode { + } else { + t.Fatal("Invalid ExportOptions.UploadBitcode default") + } } diff --git a/go/src/relparser/relfile/export_options.go b/go/src/relparser/relfile/export_options.go index a1d7696..61e6b11 100644 --- a/go/src/relparser/relfile/export_options.go +++ b/go/src/relparser/relfile/export_options.go @@ -97,6 +97,9 @@ func (opts *ExportOptions) UnmarshalYAML(unmarshal func(interface{}) error) (err } *opts = ExportOptions(*t) + if opts.CompileBitcode == false { + opts.UploadBitcode = false + } return nil } diff --git a/test/go.sh b/test/go.sh new file mode 100755 index 0000000..970e85f --- /dev/null +++ b/test/go.sh @@ -0,0 +1,17 @@ +#!/bin/bash -eu + +trap "relax keychain reset" EXIT + +test/setup.sh + +echo "Run go tests" + +>/dev/null pushd go +export GOPATH="$PWD" +go get ./src/relparser/relfile/... +go test -v ./src/relparser/relfile/... +go get ./src/lspp/... +go test -v ./src/lspp/... +>/dev/null popd + +test/teardown.sh diff --git a/test/relparser.bats b/test/relparser.bats index 416b372..cc568fa 100644 --- a/test/relparser.bats +++ b/test/relparser.bats @@ -24,7 +24,7 @@ source libexec/util-build [ "$(/usr/libexec/PlistBuddy -c "Print :teamID" $TMPDIR/options.plist)" == "J3D7L9FHSS" ] \ && [ "$(/usr/libexec/PlistBuddy -c "Print :compileBitcode" $TMPDIR/options.plist)" == "false" ] \ - && [ "$(/usr/libexec/PlistBuddy -c "Print :uploadBitcode" $TMPDIR/options.plist)" == "true" ] + && [ "$(/usr/libexec/PlistBuddy -c "Print :uploadBitcode" $TMPDIR/options.plist)" == "false" ] } @test "relparser plist" { diff --git a/test/run.sh b/test/run.sh index 842bb5b..77e52e2 100755 --- a/test/run.sh +++ b/test/run.sh @@ -1,67 +1,14 @@ #!/bin/bash -eu -if [[ $# = 0 ]]; then - keychain=relax.keychain -else - keychain=$keychain - if ! grep -q "\.keychain" <<< "$keychain"; then - echo "Error: invalid keychain name($1)" - echo " Please add '.keychain' extension." - exit 1 - fi -fi - -if [[ -f PRIVATE ]]; then - source PRIVATE # Defined 'CERTS_PASS' values -fi - -if [[ ${DECORD_KEY:-none} = "none" || ${CERTS_PASS:-none} = "none" ]]; then - echo "Error: DECORD_KEY or CERTS_PASS are not defined." - exit 1 -fi - -############################ -# Set up a custom keychain # -############################ - -relax keychain create $keychain -p relax - -relax dec -p "$DECORD_KEY" sample/certificates/RelaxCertificates.p12.enc - -relax keychain add sample/certificates/RelaxCertificates.p12 -P "$CERTS_PASS" -k $keychain -p relax - trap "relax keychain reset" EXIT -relax keychain use $keychain -p relax -################################# -# Install Provisioning Profiles # -################################# - -relax dec -p "$DECORD_KEY" sample/certificates/Relax_Development.mobileprovision.enc -relax dec -p "$DECORD_KEY" sample/certificates/Relax_AdHoc.mobileprovision.enc - -relax profile add sample/certificates/Relax_Development.mobileprovision -relax profile add sample/certificates/Relax_AdHoc.mobileprovision +test/setup.sh ############ # Run Test # ############ export NOCOLOR=true - bats test -############# -# Tear down # -############# - -relax profile rm "Relax Development" -relax profile rm "Relax AdHoc" - -# Test `relax keychain rm` -while IFS= read -r identity && [[ -n "$identity" ]] -do - relax keychain rm "$(echo "$identity" | awk '{ print $1 }')" -k $keychain -p relax -done < <(relax keychain info sample/certificates/RelaxCertificates.p12 -P "$CERTS_PASS") - -relax keychain delete $keychain +test/teardown.sh diff --git a/test/setup.sh b/test/setup.sh new file mode 100755 index 0000000..9fd0fae --- /dev/null +++ b/test/setup.sh @@ -0,0 +1,35 @@ +#!/bin/bash -eu + +KEYCHAIN=relax.keychain + +if [[ -f PRIVATE ]]; then + source PRIVATE # Defined 'CERTS_PASS' values +fi + +if [[ ${DECORD_KEY:-none} = "none" || ${CERTS_PASS:-none} = "none" ]]; then + echo "Error: DECORD_KEY or CERTS_PASS are not defined." + exit 1 +fi + +############################ +# Set up a custom keychain # +############################ + +relax KEYCHAIN create $KEYCHAIN -p relax + +relax dec -p "$DECORD_KEY" sample/certificates/RelaxCertificates.p12.enc + +relax KEYCHAIN add sample/certificates/RelaxCertificates.p12 -P "$CERTS_PASS" -k $KEYCHAIN -p relax + +relax KEYCHAIN use $KEYCHAIN -p relax + +################################# +# Install Provisioning Profiles # +################################# + +relax dec -p "$DECORD_KEY" sample/certificates/Relax_Development.mobileprovision.enc +relax dec -p "$DECORD_KEY" sample/certificates/Relax_AdHoc.mobileprovision.enc + +relax profile add sample/certificates/Relax_Development.mobileprovision +relax profile add sample/certificates/Relax_AdHoc.mobileprovision + diff --git a/test/teardown.sh b/test/teardown.sh new file mode 100755 index 0000000..a09fbad --- /dev/null +++ b/test/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash -eu + +############# +# Tear down # +############# + +KEYCHAIN=relax.keychain + +if [[ -f PRIVATE ]]; then + source PRIVATE # Defined 'CERTS_PASS' values +fi + +relax profile rm "Relax Development" +relax profile rm "Relax AdHoc" + +# Test `relax keychain rm` +while IFS= read -r identity && [[ -n "$identity" ]] +do + relax keychain rm "$(echo "$identity" | awk '{ print $1 }')" -k $KEYCHAIN -p relax +done < <(relax keychain info sample/certificates/RelaxCertificates.p12 -P "$CERTS_PASS") + +relax keychain delete $KEYCHAIN