Skip to content

Commit

Permalink
Initial setup for ci (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-s3 authored Dec 10, 2024
1 parent 12a5ae8 commit 1d604f3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 88 deletions.
94 changes: 11 additions & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,20 @@
name: Continuous Integration
on:
push:
branches: [main]
branches: [ "feature/next-gen" ]
pull_request:
branches: [ "feature/next-gen" ]

jobs:
full-build:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Full Build
run: ./fullbuild.sh
- name: Smoke Test
run: ./smoketest.sh
- name: Upload coverage to Codecov
uses: codecov/[email protected]
xcframework:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Print Swift version
run: swift --version
- name: Build xcframework
working-directory: ./SplunkRumWorkspace/SplunkRum
run: ./build_binaries.sh
- name: Upload xcframework
uses: actions/[email protected]
with:
name: SplunkOtel.xcframework
path: ./SplunkRumWorkspace/SplunkRum/xcframeworks/SplunkOtel.xcframework
saucelabs-prepare:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Build for Sauce Labs
run: |
BUILD_FOLDER="work/splunk-otel-ios/splunk-otel-ios/SauceLabsTests"
BUILD_PATH="Build/Products/Debug-iphonesimulator"
xcodebuild -showsdks
xcodebuild -workspace SplunkRumWorkspace/SplunkRumWorkspace.xcworkspace \
-scheme SauceLabsTestApp \
-configuration Debug \
-sdk iphonesimulator \
-derivedDataPath SauceLabsTests
zip ${GITHUB_WORKSPACE}/SauceLabsTestApp.zip $(find ~/$BUILD_FOLDER/$BUILD_PATH/SauceLabsTestApp.app -type f)
- name: Upload test app to Sauce Labs
id: sl-upload
run: |
cd /Users/runner/work/splunk-otel-ios/splunk-otel-ios/
item_id=$(curl -u "${{secrets.SAUCELABS_USER}}:${{secrets.SAUCELABS_KEY}}" --location \
--request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
--form 'payload=@"SauceLabsTestApp.zip"' \
--form 'name="SauceLabsTestApp.zip"' \
--form 'description="'"$GITHUB_SHA"'"' | jq -r .item.id)
echo "sl_file_id=$item_id" >> $GITHUB_OUTPUT
outputs:
sl_file_id: ${{ steps.sl-upload.outputs.sl_file_id }}
saucelabs-tests:
runs-on: macOS-latest
needs: saucelabs-prepare
strategy:
fail-fast: false
matrix:
os: ['14', '15', '16']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Run Sauce Labs test cases
working-directory: SplunkRumWorkspace
env:
SAUCELABS_USER: ${{ secrets.SAUCELABS_USER }}
SAUCELABS_KEY: ${{ secrets.SAUCELABS_KEY }}
run: |
cd SauceLabsTestApp/
python3 -m pip install Appium-Python-Client==2.11.1
python3 sl_tests.py ${{ matrix.os }} ${{ needs.saucelabs-prepare.outputs.sl_file_id }}
# build:
# runs-on: macos-14
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build
# run: ./Tools/build_frameworks.sh
# - name: Upload coverage to Codecov
# uses: codecov/[email protected]
check_links:
runs-on: ubuntu-22.04
steps:
Expand Down
2 changes: 1 addition & 1 deletion MRUMAgent/CiscoRUM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "TOOLS_DIR=\"${PROJECT_DIR}/Tools\"\n\n# Check CiscoRUM directory\ncd $PROJECT_DIR\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMlogger package\ncd ../MRUMLogger/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMSharedProtocols package\ncd ../MRUMSharedProtocols/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMSessionReplayProxy package\ncd ../MRUMSessionReplayProxy/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMCrashReports package\n# cd ../MRUMCrashReports/\n# \"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMANRReporter package\n# cd ../MRUMANRReporter/\n# \"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n";
shellScript = "TOOLS_DIR=\"${PROJECT_DIR}/Tools\"\n\n# Check CiscoRUM directory\ncd $PROJECT_DIR\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMlogger package\ncd ../MRUMLogger/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMSharedProtocols package\ncd ../MRUMSharedProtocols/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMSessionReplayProxy package\ncd ../MRUMSessionReplayProxy/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMCrashReports package\ncd ../MRUMCrashReports/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMSlowFrameDetector package\ncd ../MRUMSlowFrameDetector/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMNetwork package\ncd ../MRUMNetwork/\n\"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n\n# Check MRUMANRReporter package\n# cd ../MRUMANRReporter/\n# \"${TOOLS_DIR}/Linting.sh\" --config \"${TOOLS_DIR}/.swiftlint.yml\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
44 changes: 41 additions & 3 deletions MRUMAgent/Tools/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
disabled_rules: # rule identifiers to exclude from running
- inclusive_language

analyzer_rules:
- unused_declaration

Expand All @@ -12,3 +9,44 @@ identifier_name:

vertical_whitespace:
max_empty_lines: 2

opt_in_rules:
- unowned_variable_capture
- array_init
- identical_operands
- overridden_super_call
- override_in_extension
- prohibited_super_call
- quick_discouraged_call
- required_enum_case
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- empty_collection_literal
- empty_string
- first_where
- flatmap_over_map_reduce
- last_where
- sorted_first_last
- file_header

file_header:
required_pattern: |
\/.
Copyright 202. Splunk Inc.
Licensed under the Apache License, Version 2.0 \(the "License"\);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:\/\/www.apache.org\/licenses\/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
excluded:
- ${PWD}/Package.swift
2 changes: 1 addition & 1 deletion MRUMAgent/Tools/Linting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ else
fi

if which swiftformat >/dev/null; then
swiftformat . --lenient --lint --indent 4 --commas inline --stripunusedargs closure-only --swiftversion 5 --disable consecutiveBlankLines, wrapMultilineStatementBraces, braces, enumNamespaces, blankLinesAtStartOfScope
swiftformat . --lenient --lint --commas inline --stripunusedargs closure-only --swiftversion 5 --disable indent,consecutiveBlankLines,wrapMultilineStatementBraces, braces,enumNamespaces,blankLinesAtStartOfScope
else
echo "warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat"
fi

0 comments on commit 1d604f3

Please sign in to comment.