Nr 318119 auto collect stdout & stderr logs #1182
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: CI | |
on: | |
push: | |
branches: | |
- staging | |
- main | |
- develop | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
testIOS: | |
name : TestIOS | |
# runs-on: will be set to macos-latest when running on actual GHA. | |
# *** runs-on: ubuntu-latest is used when running via act on mac os. *** | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@master | |
with: | |
submodules: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.3' | |
- name: Install lcov | |
run: | | |
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/e92d2ae54954ebf485b484d8522104700b144fee/Formula/lcov.rb > lcov.rb | |
brew install ./lcov.rb | |
- name: Update gem | |
run: bundle update | |
- name: Install gems | |
run: bundle install | |
- name: Run tests on iOS (using fastlane) | |
run: bundle exec fastlane runIOSTests | |
testTVOS: | |
name : TestTVOS | |
# runs-on: will be set to macos-latest when running on actual GHA. | |
# *** runs-on: ubuntu-latest is used when running via act on mac os. *** | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.3' | |
- name: Install lcov | |
run: brew install lcov | |
- name: Update gem | |
run: bundle update | |
- name: Install gems | |
run: bundle install | |
- name: Run tests on tvOS (using fastlane) | |
run: bundle exec fastlane runTVOSTests | |
testWatchOS: | |
name : TestWatchOS | |
# runs-on: will be set to macos-latest when running on actual GHA. | |
# *** runs-on: ubuntu-latest is used when running via act on mac os. *** | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.3' | |
- name: Install lcov | |
run: brew install lcov | |
- name: Update gem | |
run: bundle update | |
- name: Install gems | |
run: bundle install | |
- name: Run tests on watchOS (using fastlane) | |
run: bundle exec fastlane runWatchOSTests | |
deployS3: | |
name: DeployS3 | |
# runs-on: will be set to macos-latest when running on actual GHA. | |
# *** runs-on: ubuntu-latest is used when running via act on mac os. *** | |
runs-on: macos-13 | |
needs: [testIOS, testTVOS, testWatchOS] | |
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' | |
outputs: | |
version: ${{ steps.setOutput.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.3' | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
# echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# # apply provisioning profile | |
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Update gem | |
run: bundle update | |
- name: Install gems | |
run: bundle install | |
- name: Build NewRelic.xcframework (using fastlane) | |
run: bundle exec fastlane buildAndZip | |
- name: Get name | |
run: echo "version=$(cat fastlane/build_version)" >> $GITHUB_ENV | |
- id: setOutput | |
name: Print name | |
run: echo "version=${{ env.version }}" >> $GITHUB_OUTPUT | |
- name: Deploy to staging S3 | |
run: "aws s3 cp NewRelic_XCFramework_Agent_${{ env.version }}.zip s3://nr-downloads-main/ios-v5/" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Upload build reports | |
if: failure() && steps.build-step.outcome != 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-reports | |
path: /Users/runner/Library/Logs/fastlane/xcbuild/ | |
# Create NewRelicAgent.podspec & Package.swift with new version number and checksum. | |
deployStagingSpecs: | |
name: DeployStagingSpecs | |
runs-on: macos-latest | |
needs: [deployS3] | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Update gem | |
run: bundle update | |
- name: Install gems | |
run: bundle install | |
- name: Get name | |
run: echo "version=${{needs.deployS3.outputs.version}}" >> $GITHUB_ENV | |
- name: Print XCFramework name | |
run: echo "${{ env.version }}" | |
- name: Create Podspec for XCFramework version | |
run: | | |
cp cocoapods/NewRelicAgent.podspec.template NewRelicAgent.podspec | |
REPLACE=X.XX | |
sed -i bak "s/$REPLACE/${{ env.version }}/g" NewRelicAgent.podspec | |
sed -i -e 's/ios_agent/ios-v5/g' NewRelicAgent.podspec | |
rm NewRelicAgent.podspec-e | |
rm NewRelicAgent.podspecbak | |
- name: Create Package.swift for XCFramework version | |
run: | | |
cp NewRelic-SwiftPackage/Package.swift.template Package.swift | |
## Below README required for prod spm repo. | |
# cp cocoapods/README.md README.md | |
REPLACEVER={{VERSION}} | |
REPLACECHECKSUM={{CHECKSUM}} | |
XCFRAMEWORK_NAME="NewRelic_XCFramework_Agent_${{ env.version }}.zip" | |
curl https://download.newrelic.com/ios-v5/$XCFRAMEWORK_NAME -o $XCFRAMEWORK_NAME | |
SPM_CHECKSUM=`swift package compute-checksum ${XCFRAMEWORK_NAME}` | |
sed -i bak "s/$REPLACEVER/${{ env.version }}/g" Package.swift | |
sed -i -e "s/$REPLACECHECKSUM/$SPM_CHECKSUM/g" Package.swift | |
sed -i -e 's/ios_agent/ios-v5/g' Package.swift | |
rm Package.swift-e | |
rm Package.swiftbak | |
rm $XCFRAMEWORK_NAME | |
# Use git-auto-commit-action to push NewRelicAgent.podspec & Package.swift up to root of newrelic-ios-agent branch: staging. | |
# This should also tag the staging release branch w/ version number tag. | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "[${{ env.version }}] Staging Release" | |
branch: staging | |
tagging_message: "${{ env.version }}" |