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

Add integration tests to Travis #133

Merged
merged 1 commit into from
Jul 19, 2018
Merged
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
39 changes: 26 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Use new container infrastructure to enable caching
sudo: false
os: osx
osx_image: xcode9.4

# Choose a lightweight base image; we provide our own build tools.
language: c
# Use new container infrastructure to enable caching
rvm: 2.1
sudo: true

# GHC depends on GMP. You can add other dependencies here as well.
addons:
apt:
packages:
- libgmp-dev
language: ruby

# The different configurations we want to test. You could also do things like
# change flags or use --stack-yaml to point to a different file.
Expand All @@ -17,16 +14,29 @@ env:

before_install:
# Update ruby
- rvm use 2.1 --install --binary --fuzzy
# - rvm use 2.1 --install --binary --fuzzy

# Update Homebrew
- brew update

# Download and unpack the stack executable
# Install stack
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- brew install stack

# Download and instal hlint
- rake hlint:install[2.0.9]

# Download and install minio
- test ! -e $HOME/.local/bin/minio && travis_retry wget -O $HOME/.local/bin/minio https://dl.minio.io/server/minio/release/darwin-amd64/minio || echo "Minio already in cache"
- chmod +x $HOME/.local/bin/minio

# Install Carthage
- brew outdated carthage || brew upgrade carthage

# Install bats-core
- brew install bats-core

install:
# Run bundler and install the dependencies in vendor/bundle
# so that it can be cached.
Expand All @@ -41,10 +51,13 @@ script:
- stack $ARGS test --no-terminal --haddock --no-haddock-deps
- stack $ARGS build
- stack $ARGS sdist
- bundle exec pod lib lint
- stack $ARGS install
- bats integration-tests/tests.bats
# - bundle exec pod lib lint # this just won't work for some reason

# Caching so the next build will be fast too.
cache:
directories:
- $HOME/.local/bin
- $HOME/.stack
- vendor/bundle
38 changes: 19 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.2)
claide (1.0.2)
claide-plugins (0.9.2)
Expand Down Expand Up @@ -48,12 +48,12 @@ GEM
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
coderay (1.1.1)
coderay (1.1.2)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
cork (0.3.0)
colored2 (~> 3.1)
danger (5.3.3)
danger (5.6.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
Expand All @@ -62,50 +62,50 @@ GEM
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
danger-hlint (0.0.3)
danger-hlint (0.0.5)
danger-plugin-api (~> 1.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
escape (0.0.4)
faraday (0.12.1)
faraday (0.15.2)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.3.0)
git (1.4.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (1.14.0)
method_source (0.8.2)
kramdown (1.17.0)
method_source (0.9.0)
minitest (5.11.3)
molinillo (0.6.5)
multipart-post (2.0.0)
nanaimo (0.2.5)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
octokit (4.7.0)
no_proxy_fix (0.1.2)
octokit (4.9.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
pry (0.10.4)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
ruby-macho (1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
ruby-macho (1.2.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
slop (3.6.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
unicode-display_width (1.4.0)
xcodeproj (1.5.9)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
Expand All @@ -123,4 +123,4 @@ DEPENDENCIES
pry

BUNDLED WITH
1.16.1
1.16.2
192 changes: 192 additions & 0 deletions integration-tests/tests.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
#!/usr/bin/env bats

setup() {

cd $BATS_TMPDIR

rm -rf Rome-Tests

mkdir Rome-Tests && cd Rome-Tests

if [ "$BATS_TEST_NUMBER" -eq 1 ]; then
echo 'github "Alamofire/Alamofire" == 4.7.3' > Cartfile
carthage bootstrap --cache-builds --no-use-binaries

rm -rf ../_Carthage_build_bkp
cp -R Carthage/Build/ ../_Carthage_build_bkp

rm -f ../_Cartfile_bkp
rm -f ../_Cartfile.resolved_bkp
cp Cartfile ../_Cartfile_bkp
cp Cartfile.resolved ../_Cartfile.resolved_bkp

else
mkdir -p Carthage/Build
cp -R ../_Carthage_build_bkp/ Carthage/Build
cp ../_Cartfile_bkp Cartfile
cp ../_Cartfile.resolved_bkp Cartfile.resolved
fi

printf "[Cache]\n S3-Bucket = rome\n local = rome-local-cache" >> Romefile
mkdir -p ~/.aws
printf "[default]\n region = us-east-1" >> ~/.aws/config

# minio

mkdir -p minio-buckets/rome

IOS_DWARFDUMP_OUT=($(dwarfdump -u Carthage/Build/iOS/Alamofire.framework/Alamofire))
TVOS_DWARFDUMP_OUT=($(dwarfdump -u Carthage/Build/tvOS/Alamofire.framework/Alamofire))
WATCHOS_DWARFDUMP_OUT=($(dwarfdump -u Carthage/Build/watchOS/Alamofire.framework/Alamofire))

export IOS_ARMV7_DWARF_UUID=${IOS_DWARFDUMP_OUT[9]}
export IOS_ARM64_DWARF_UUID=${IOS_DWARFDUMP_OUT[13]}
export TVOS_ARM64_DWARF_UUID=${TVOS_DWARFDUMP_OUT[5]}
export WATCHOS_ARMV7K_DWARF_UUID=${WATCHOS_DWARFDUMP_OUT[5]}

export AWS_ACCESS_KEY_ID=Q3AM3UQ867SPQQA43P2F
export AWS_SECRET_ACCESS_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
export MINIO_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F
export MINIO_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
export AWS_ENDPOINT=http://127.0.0.1:9000

}

teardown() {

if [ ! "$BATS_TEST_NUMBER" -eq 3 ]; then
killall minio
fi
cd $BATS_TEST_DIRNAME
}


@test "rome uploads all artifacts" {

MINIO_HTTP_TRACE=output.log minio server minio-buckets &
sleep 4

run rome upload --cache-prefix travis

if [ -d "minio-buckets/rome" ]; then
cp -R minio-buckets/rome/ ../_rome_bkp
fi

[ "$status" -eq 0 ]

# Version file
[ -e "minio-buckets/rome/travis/Alamofire/.Alamofire.version-4.7.3" ]

# macOS - No bitecode, No bcsymbolmap
[ -e "minio-buckets/rome/travis/Alamofire/Mac/Alamofire.framework-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/Mac/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/Mac/Alamofire.framework-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/Mac/Alamofire.framework.dSYM-4.7.3.zip" ]

# iOS
[ -e "minio-buckets/rome/travis/Alamofire/iOS/Alamofire.framework-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/iOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/iOS/${IOS_ARMV7_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/iOS/${IOS_ARM64_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/iOS/Alamofire.framework-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/iOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/iOS/${IOS_ARMV7_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/iOS/${IOS_ARM64_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]

# tvOS
[ -e "minio-buckets/rome/travis/Alamofire/tvOS/Alamofire.framework-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/tvOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/tvOS/${TVOS_ARM64_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/tvOS/Alamofire.framework-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/tvOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/tvOS/${TVOS_ARM64_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]

# watchOS
[ -e "minio-buckets/rome/travis/Alamofire/watchOS/Alamofire.framework-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/watchOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "minio-buckets/rome/travis/Alamofire/watchOS/${WATCHOS_ARMV7K_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/watchOS/Alamofire.framework-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/watchOS/Alamofire.framework.dSYM-4.7.3.zip" ]
[ -e "rome-local-cache/travis/Alamofire/watchOS/${WATCHOS_ARMV7K_DWARF_UUID}.bcsymbolmap-4.7.3.zip" ]

#save the local cache for later

rm -rf ../_rome-local-cache_bkp
cp -R rome-local-cache/ ../_rome-local-cache_bkp

}

@test "rome downloads all artifacts skipping local cache" {

if [ -d "../_rome_bkp" ]; then
echo "# Minio bucket restored" >&3
cp -R ../_rome_bkp/ minio-buckets/rome
fi

MINIO_HTTP_TRACE=output.log minio server minio-buckets &
sleep 4

rm -rf Carthage/Build
run rome download --cache-prefix travis --skip-local-cache

[ "$status" -eq 0 ]

# Version file
[ -e "Carthage/Build/.Alamofire.version" ]

# macOS - No bitcode, No bcsymbolmap
[ -d "Carthage/Build/Mac/Alamofire.framework" ]
[ -d "Carthage/Build/Mac/Alamofire.framework.dSYM" ]

# iOS
[ -d "Carthage/Build/iOS/Alamofire.framework" ]
[ -d "Carthage/Build/iOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/iOS/${IOS_ARMV7_DWARF_UUID}.bcsymbolmap" ]
[ -e "Carthage/Build/iOS/${IOS_ARM64_DWARF_UUID}.bcsymbolmap" ]

# tvOS
[ -d "Carthage/Build/tvOS/Alamofire.framework" ]
[ -d "Carthage/Build/tvOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/tvOS/${TVOS_ARM64_DWARF_UUID}.bcsymbolmap" ]

# watchOS
[ -d "Carthage/Build/watchOS/Alamofire.framework" ]
[ -d "Carthage/Build/watchOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/watchOS/${WATCHOS_ARMV7K_DWARF_UUID}.bcsymbolmap" ]
}

@test "rome downloads all artifacts from the local cache" {

if [ -d "../_rome-local-cache_bkp" ]; then
echo "# Rome local cache restored" >&3
cp -R ../_rome-local-cache_bkp/ rome-local-cache
fi

rm -rf Carthage/Build
run rome download --cache-prefix travis

[ "$status" -eq 0 ]

# Version file
[ -e "Carthage/Build/.Alamofire.version" ]

# macOS - No bitecode, No bcsymbolmap
[ -d "Carthage/Build/Mac/Alamofire.framework" ]
[ -d "Carthage/Build/Mac/Alamofire.framework.dSYM" ]

# iOS
[ -d "Carthage/Build/iOS/Alamofire.framework" ]
[ -d "Carthage/Build/iOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/iOS/${IOS_ARMV7_DWARF_UUID}.bcsymbolmap" ]
[ -e "Carthage/Build/iOS/${IOS_ARM64_DWARF_UUID}.bcsymbolmap" ]

# tvOS
[ -d "Carthage/Build/tvOS/Alamofire.framework" ]
[ -d "Carthage/Build/tvOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/tvOS/${TVOS_ARM64_DWARF_UUID}.bcsymbolmap" ]

# watchOS
[ -d "Carthage/Build/watchOS/Alamofire.framework" ]
[ -d "Carthage/Build/watchOS/Alamofire.framework.dSYM" ]
[ -e "Carthage/Build/watchOS/${WATCHOS_ARMV7K_DWARF_UUID}.bcsymbolmap" ]
}