Skip to content

Commit

Permalink
added running of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vkaltyrin committed Apr 1, 2024
1 parent e55ccc3 commit e06ccf5
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Code Quality Check / Perform Unit Testing

on:
pull_request:

concurrency:
# New commit on branch cancels running workflows of the same branch
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
runs-on: macos-latest
environment: sdds

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'

- name: Run build script
run: |
chmod +x ./scripts/build.sh
./scripts/build.sh
2 changes: 1 addition & 1 deletion SDDSCore/SDDSCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"${SRCROOT}/../lint.sh\"\n";
shellScript = "if [ \"$SKIP_LINT\" == \"YES\" ]; then\n echo \"Skipping Lint...\"\n exit 0\nfi\n\n/bin/sh \"${SRCROOT}/../lint.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"${SRCROOT}/../lint.sh\"\n";
shellScript = "if [ \"$SKIP_LINT\" == \"YES\" ]; then\n echo \"Skipping Lint...\"\n exit 0\nfi\n\n/bin/sh \"${SRCROOT}/../lint.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"${SRCROOT}/../lint.sh\"\n";
shellScript = "if [ \"$SKIP_LINT\" == \"YES\" ]; then\n echo \"Skipping Lint...\"\n exit 0\nfi\n\n/bin/sh \"${SRCROOT}/../lint.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion SDDSSwiftUI/SDDSSwiftUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"${SRCROOT}/../lint.sh\"\n";
shellScript = "if [ \"$SKIP_LINT\" == \"YES\" ]; then\n echo \"Skipping Lint...\"\n exit 0\nfi\n\n/bin/sh \"${SRCROOT}/../lint.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion SDDSUIKit/SDDSUIKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"${SRCROOT}/../lint.sh\"\n";
shellScript = "if [ \"$SKIP_LINT\" == \"YES\" ]; then\n echo \"Skipping Lint...\"\n exit 0\nfi\n\n/bin/sh \"${SRCROOT}/../lint.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
32 changes: 32 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
source "$(dirname "$0")/pretty_echo.sh"

PROJECT_ROOT_DIR="$(dirname "$0")/.."
PROJECT_ROOT_DIR=$(cd "$PROJECT_ROOT_DIR" && pwd)
print_info "Root directory is ${PROJECT_ROOT_DIR}"

WORKSPACE_NAME="SDDS.xcworkspace"
WORKSPACE_PATH="${PROJECT_ROOT_DIR}/${WORKSPACE_NAME}"
print_info "XCWorkspace path is ${PROJECT_ROOT_DIR}"

modules=("SDDSSwiftUI" "SDDSUIKit" "SDDSIcons" "SDDSCore")

print_info "Running tests for all targets..."
for MODULE in "${!modules[@]}"; do
SCHEME=${modules[$MODULE]}
XCODE_PROJECT_PATH="${PROJECT_ROOT_DIR}/${SCHEME}/${SCHEME}.xcodeproj"

print_info "Running tests for the scheme $SCHEME"

SKIP_LINT=YES xcodebuild -scheme ${SCHEME} -workspace ${WORKSPACE_PATH} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max' test

if [ $? -ne 0 ]; then
print_error "Tests failed for the scheme $SCHEME."
exit 1
else
print_success "Tests succeeded for the scheme $SCHEME"
fi

done

print_success "All tests succeeded"

0 comments on commit e06ccf5

Please sign in to comment.