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

Initial Plugin version #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run commitlint on the commit messages in a pull request.

name: Lint Commit Messages

on:
- pull_request

jobs:
commitlint:
uses: edx/.github/.github/workflows/commitlint.yml@master
33 changes: 33 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: SwiftLint

on:
workflow_dispatch:

pull_request:

jobs:
lint:
name: SwiftLint
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Setup
run:
xcodes select 16.1

- name: SwiftLint
run:
swift package plugin --allow-writing-to-package-directory swiftlint --reporter sarif --output swiftlint.report.sarif

- name: Prepare swiftlint.report.sarif
if: success() || failure()
run:
swift PrepareSarifToUpload.swift

- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: swiftlint.report.sarif
33 changes: 33 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will test a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: Unit Tests

on:
- pull_request

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
test-ios:
name: iOS 18.1
runs-on: macos-latest
env:
DEVELOPER_DIR: "/Applications/Xcode_16.1.app/Contents/Developer"

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Run Unit Tests
- name: Run tests
run: |
xcodebuild test \
-scheme EDXMobileAnalytics \
-sdk iphonesimulator \
-destination "OS=18.1,name=iPhone 16 Pro" \
-skipPackagePluginValidation \
-skipMacroValidation
22 changes: 22 additions & 0 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: XCodeBuild

on:
workflow_dispatch:

pull_request:

jobs:
build:
name: Build
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Setup
run:
xcodes select 16.1

- name: Build
run:
xcodebuild -scheme EDXMobileAnalytics -destination 'platform=iOS Simulator,name=iPhone SE (3rd generation)' -skipPackagePluginValidation -skipMacroValidation build
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
54 changes: 54 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
warning_threshold: 1
disabled_rules: # rule identifiers to exclude from running
- identifier_name
- comment_spacing
- force_cast
- empty_count
- nesting
- cyclomatic_complexity
- multiple_closures_with_trailing_closure
# - colon
# - comma
# - control_statement
opt_in_rules: # some rules are only opt-in
- empty_count
# Find all the available rules by running:
# swiftlint rules
#included: # paths to include during linting. `--path` is ignored if present.
# - Source
excluded: # paths to ignore during linting. Takes precedence over `included`.
- .build/*
# - Source/*/ExcludedFile.swift # Exclude files with a wildcard
#analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
# - explicit_self

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
#force_cast: warning

force_try: error

line_length: 120
type_body_length: 300

trailing_whitespace:
ignores_empty_lines: true

file_length:
warning: 500
error: 1200

function_parameter_count:
warning: 10
error: 12

type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: # excluded via string
- iPhone
- API

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
24 changes: 24 additions & 0 deletions .swiftpm/EDXMobileAnalyticsTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "9C579E52-1C40-498C-A511-1565F9BFD1AE",
"name" : "Test Scheme Action",
"options" : {

}
}
],
"defaultOptions" : {

},
"testTargets" : [
{
"target" : {
"containerPath" : "container:",
"identifier" : "EDXMobileAnalyticsTests",
"name" : "EDXMobileAnalyticsTests"
}
}
],
"version" : 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
version = "2.2">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<AutocreatedTestPlanReference>
</AutocreatedTestPlanReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<TestPlanReference
reference = "container:.swiftpm/EDXMobileAnalyticsTests.xctestplan">
</TestPlanReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:.swiftpm/EDXMobileAnalyticsTests.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDXMobileAnalyticsTests"
BuildableName = "EDXMobileAnalyticsTests"
BlueprintName = "EDXMobileAnalyticsTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDXMobileAnalyticsTests"
BuildableName = "EDXMobileAnalyticsTests"
BlueprintName = "EDXMobileAnalyticsTests"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Loading
Loading