NominationPools selection #598
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test on PR | |
on: | |
pull_request: | |
jobs: | |
build: | |
name: Build and Test default scheme using any available iPhone simulator | |
runs-on: macos-12 | |
steps: | |
- uses: sinoru/actions-setup-xcode@v2 | |
with: | |
xcode-version: '14.1' | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Cache Cocoapods | |
id: cache-cocoapods | |
uses: actions/cache@v2 | |
with: | |
path: Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Install Cocoapods | |
run: pod install --repo-update | |
- name: Set Default Scheme | |
run: | | |
scheme_list=$(xcodebuild -list -json | tr -d "\n") | |
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]") | |
echo $default | cat >default | |
echo Using default scheme: $default | |
- name: Build | |
env: | |
scheme: ${{ 'default' }} | |
platform: ${{ 'iOS Simulator' }} | |
device: ${{ 'iPhone 11' }} | |
MERCURYO_PRODUCTION_SECRET: ${{ secrets.MERCURYO_PRODUCTION_SECRET }} | |
MERCURYO_TEST_SECRET: ${{ secrets.MERCURYO_TEST_SECRET }} | |
MOONBEAM_HISTORY_API_KEY: ${{ secrets.MOONBEAM_HISTORY_API_KEY }} | |
MOONRIVER_HISTORY_API_KEY: ${{ secrets.MOONRIVER_HISTORY_API_KEY }} | |
ETHERSCAN_HISTORY_API_KEY: ${{ secrets.ETHERSCAN_HISTORY_API_KEY }} | |
ACALA_AUTH_TOKEN: ${{ secrets.ACALA_AUTH_TOKEN }} | |
ACALA_TEST_AUTH_TOKEN: ${{ secrets.ACALA_TEST_AUTH_TOKEN }} | |
MOONBEAM_API_KEY: ${{ secrets.MOONBEAM_API_KEY }} | |
MOONBEAM_TEST_API_KEY: ${{ secrets.MOONBEAM_TEST_API_KEY }} | |
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }} | |
run: | | |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) | |
# device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}'` | |
if [ $scheme = default ]; then scheme=$(cat default); fi | |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi | |
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` | |
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device" | |
- name: Test | |
env: | |
scheme: ${{ 'default' }} | |
platform: ${{ 'iOS Simulator' }} | |
device: ${{ 'iPhone 11' }} | |
run: | | |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) | |
# device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}'` | |
if [ $scheme = default ]; then scheme=$(cat default); fi | |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi | |
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` | |
xcodebuild test-without-building -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device" |