Skip to content

Use DNS query to threema.ch for checking internet reachability #3

Use DNS query to threema.ch for checking internet reachability

Use DNS query to threema.ch for checking internet reachability #3

name: Integration Tests
on:
push:
branches:
- master
pull_request:
paths:
- 'Sources/**'
- 'Tests/**'
- 'scripts/**'
- '.github/workflows/integration-tests.yml'
- 'fastlane/**'
jobs:
# Ensure the swizzling of network classes doesn't break the normal functionality of web requests.
# We borrow the tests of Alamofire under the MIT license: https://github.com/Alamofire/Alamofire.
# The following steps checkout Alamofire and apply a github patch to the project. The patch adds
# Sentry to the tests with auto performance monitoring enabled. While the tests are running a
# transaction is bound to the scope, so the Sentry SDK adds spans to the transaction. This doesn't
# validate if the Sentry SDK adds proper spans. It only validates that the swizzling logic
# doesn't break web requests.
web-request-tests:
name: Integration Web Requests
runs-on: macos-11
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
repository: 'Alamofire/Alamofire'
ref: 'f82c23a8a7ef8dc1a49a8bfc6a96883e79121864'
# Use github.event.pull_request.head.sha instead of github.sha when available as
# the github.sha is the pre merge commit id for PRs.
# See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906.
- name: Download Apply Patch Script
run: >-
if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.event.pull_request.head.sha }}/scripts/apply-patch.sh --output apply-patch.sh
else
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.sha }}/scripts/apply-patch.sh --output apply-patch.sh
fi
chmod +x apply-patch.sh
shell: bash
- name: Download and Apply Patch
run: ./apply-patch.sh "${{ github.event.pull_request.head.sha }}" "${{ github.sha }}" add-sentry-to-alamofire
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk
- name: Start Firewalk
run: firewalk &
- name: Validate Firewalk is running
run: curl http://localhost:8080/
- name: Run tests
# Run the tests twice, because they are sometimes flaky.
# We skip two tests because it also fails sometimes when not adding Sentry to Alamofire.
run: |
for i in {1..2}; do \
set -o pipefail && env NSUnbufferedIO=YES \
xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "OS=15.2,name=iPhone 13 Pro" \
-skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorThrowsMissingCredentialErrorWhenCredentialIsNilAndRequestShouldBeRetried" \
-skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorRetriesRequestThatFailedWithOutdatedCredential" \
test | xcpretty \
&& break ; done
# We borrow the tests of Home Assistant under the Apache license: https://github.com/home-assistant/iOS.
# The following steps checkout Home Assistant and apply a github patch to the project. The patch adds
# Sentry to the app with auto performance monitoring enabled. We then run the UI tests to make sure
# adding our SDK doesn't cause any major issues.
home-assistant-tests:
runs-on: macos-11
timeout-minutes: 60
env:
DEVELOPER_DIR: /Applications/Xcode_13.2.app/Contents/Developer
steps:
- uses: actions/checkout@v3
with:
repository: 'home-assistant/iOS'
ref: '6d6606aed63a778c5a2bd64f8981823433a7f2fa'
# Use github.event.pull_request.head.sha instead of github.sha when available as
# the github.sha is the pre merge commit id for PRs.
# See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906.
- name: Download Apply Patch Script
run: >-
if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.event.pull_request.head.sha }}/scripts/apply-patch.sh --output apply-patch.sh
else
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.sha }}/scripts/apply-patch.sh --output apply-patch.sh
fi
chmod +x apply-patch.sh
shell: bash
- name: Download and Apply Patch
run: ./apply-patch.sh "${{ github.event.pull_request.head.sha }}" "${{ github.sha }}" add-sentry-to-homekit
- uses: actions/cache@v3
name: 'Cache: Gems'
id: cache_gems
with:
path: vendor/bundle
key: home-assistant-integration-gems-${{ runner.os }}-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('**/Gemfile.lock') }}
- uses: actions/cache@v3
name: 'Cache: Pods'
id: cache_pods
if: steps.cache_gems.outputs.cache-hit == 'true'
with:
path: |
Pods
Podfile
Podfile.lock
Tools/**
key: home-assistant-tests-pods-${{ runner.os }}-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('Podfile', '**/Podfile.lock', 'Tools/**') }}
- name: Install Gems
if: steps.cache_gems.outputs.cache-hit != 'true'
run: |
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- name: Install Pods Release
if: steps.cache_pods.outputs.cache-hit != 'true'
run: |
bundle config set --local path 'vendor/bundle'
bundle exec pod install --repo-update
- name: Run tests
# Run the tests twice in case they are flaky.
run: |
bundle config set --local path 'vendor/bundle'
for i in {1..2}; do bundle exec fastlane test && break ; done
# We borrow the tests of VLC iOS under the GPLv2 (or later) and the MPLv2: https://github.com/videolan/vlc-ios
# The following steps checkout VLC and apply a github patch to the project. The patch adds
# Sentry to the app with auto performance monitoring enabled. We then run the UI tests to make sure
# adding our SDK doesn't cause any major issues.
vlc-tests:
runs-on: macos-12
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: 'videolan/vlc-ios'
ref: '5d2b5505edc3387cad43deca14c0bd0b19e3f133'
# Use github.event.pull_request.head.sha instead of github.sha when available as
# the github.sha is the pre merge commit id for PRs.
# See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906.
- name: Download Apply Patch Script
run: >-
if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.event.pull_request.head.sha }}/scripts/apply-patch.sh --output apply-patch.sh
else
curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.sha }}/scripts/apply-patch.sh --output apply-patch.sh
fi
chmod +x apply-patch.sh
shell: bash
- name: Download and Apply Patch
run: ./apply-patch.sh "${{ github.event.pull_request.head.sha }}" "${{ github.sha }}" add-sentry-to-vlc
- uses: actions/cache@v3
name: 'Cache: Pods'
id: cache-pods
with:
path: Pods
key: >-
${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
- name: Install Pods
if: steps.cache_pods.outputs.cache-hit != 'true'
run: pod install
- name: Run UI Tests
# Run the tests twice in case they are flaky.
run: for i in {1..2} ; do set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace "VLC.xcworkspace" -scheme "VLC-iOS-UITests" -destination "platform=iOS Simulator,OS=16.0,name=iPhone 13 Pro" test | xcpretty && break ; done