Skip to content

Commit

Permalink
[ci] fix test.yaml workflow and codecov upload (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight authored Apr 5, 2024
1 parent e36f129 commit c882ff8
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 31 deletions.
25 changes: 25 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
codecov:
branch: main
require_ci_to_pass: yes
notify:
wait_for_ci: yes

coverage:
range: 80...100
precision: 3
round: down

ignore:
- "EmpowerPlantTests/*"

comment:
layout: "reach,diff,flags,files,footer"
# Update, if comment exists. Otherwise post new.
behavior: default
# Comments will only post when coverage changes. Furthermore, if a comment
# already exists, and a newer commit results in no coverage change for the
# entire pull, the comment will be deleted.
require_changes: true
require_base: yes # must have a base report to post
require_head: yes # must have a head report to post

25 changes: 8 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
name: test.yml

on:
push:
branches:
- integrate_codecov
workflow_dispatch:
pull_request:

jobs:
build:
runs-on: macos-latest
runs-on: macos-14

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

- name: Install Bundler
run: gem install bundler

- name: Install dependencies
run: bundle install
- name: Install Slather
run: gem install slather

- name: Build and Test
run: |
swift build
swift test
- name: Generate Coverage Report
run: |
xcrun xccov view --report <derived-data-path>/Logs/Test/*.xccovreport > coverage.txt
run: make test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
8 changes: 0 additions & 8 deletions .github/workflows/upload-codecov-report.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.env
build/
release-build.log
EmpowerPlant_release.zip
EmpowerPlant_release.zip
slather/
6 changes: 6 additions & 0 deletions .slather.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage_service: cobertura_xml
xcodeproj: EmpowerPlant.xcodeproj
scheme: EmpowerPlant
source_directory: EmpowerPlant
output_directory: slather
build_directory: build
114 changes: 110 additions & 4 deletions EmpowerPlant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
840B7EF12BBF3C70008B8120 /* .slather.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .slather.yml; sourceTree = "<group>"; };
843BD60E2AD08CE900B0098F /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
843BD6262AD7798C00B0098F /* jwt-deep-field.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "jwt-deep-field.png"; sourceTree = "<group>"; };
846BEA1A2ABE46880032F77F /* upload-symbols.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "upload-symbols.sh"; sourceTree = "<group>"; };
846BEA1B2ABE611A0032F77F /* mobydick.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = mobydick.txt; sourceTree = "<group>"; };
8474F0482ACCE2D800F21E06 /* deploy_project.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = deploy_project.sh; sourceTree = "<group>"; };
8474F04D2ACE54F300F21E06 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
848A45262BBFC79E006AAAEC /* .codecov.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .codecov.yml; sourceTree = "<group>"; };
84A264182AA9155800A62A88 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
84A264192AA915B100A62A88 /* Brewfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Brewfile; sourceTree = "<group>"; };
84A2641B2AA915D800A62A88 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,8 +105,10 @@
8474F0482ACCE2D800F21E06 /* deploy_project.sh */,
84A2641E2AA926A300A62A88 /* .env */,
846BEA1A2ABE46880032F77F /* upload-symbols.sh */,
840B7EF12BBF3C70008B8120 /* .slather.yml */,
84A264192AA915B100A62A88 /* Brewfile */,
84A264182AA9155800A62A88 /* Makefile */,
848A45262BBFC79E006AAAEC /* .codecov.yml */,
84A2641B2AA915D800A62A88 /* README.md */,
D17C73B127D8291D006650AF /* EmpowerPlant */,
8BA3AB2D2A201FE900BE1EA8 /* EmpowerPlantTests */,
Expand Down Expand Up @@ -323,6 +327,107 @@
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
848A45232BBFC6FE006AAAEC /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Test;
};
848A45242BBFC6FE006AAAEC /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 97JCY7859U;
INFOPLIST_FILE = EmpowerPlant/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = sentrydemos.ios.EmpowerPlant;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Test;
};
848A45252BBFC6FE006AAAEC /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = sentrydemos.ios.EmpowerPlantTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EmpowerPlant.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/EmpowerPlant";
};
name = Test;
};
8BA3AB322A201FE900BE1EA8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand All @@ -332,7 +437,6 @@
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = sentrydemos.ios.EmpowerPlantTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -351,7 +455,6 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = sentrydemos.ios.EmpowerPlantTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -402,6 +505,7 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -414,7 +518,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -463,14 +566,14 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -527,6 +630,7 @@
isa = XCConfigurationList;
buildConfigurations = (
8BA3AB322A201FE900BE1EA8 /* Debug */,
848A45252BBFC6FE006AAAEC /* Test */,
8BA3AB332A201FE900BE1EA8 /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand All @@ -536,6 +640,7 @@
isa = XCConfigurationList;
buildConfigurations = (
D17C73C127D8291D006650AF /* Debug */,
848A45232BBFC6FE006AAAEC /* Test */,
D17C73C227D8291D006650AF /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand All @@ -545,6 +650,7 @@
isa = XCConfigurationList;
buildConfigurations = (
D17C73C427D8291D006650AF /* Debug */,
848A45242BBFC6FE006AAAEC /* Test */,
D17C73C527D8291D006650AF /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ init:
# download iOS platform image
# (happens on fresh xcode installation or MAS-managed major version update)
xcodebuild -downloadPlatform iOS

.PHONY: test
test:
xcodebuild -project EmpowerPlant.xcodeproj -scheme EmpowerPlant -configuration Test -derivedDataPath build -destination "platform=iOS Simulator,OS=latest,name=iPhone 15" -quiet test
slather coverage --configuration Test --verbose
2 changes: 1 addition & 1 deletion deploy_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SENTRY_AUTH_TOKEN_INPUT=${4}

# Build the release bundle
echo "Building the release bundle..."
SENTRY_ORG=$SENTRY_ORG_INPUT SENTRY_PROJECT=$SENTRY_PROJECT_INPUT SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN_INPUT xcodebuild -project EmpowerPlant.xcodeproj -scheme EmpowerPlant -configuration Release -derivedDataPath build -destination "platform=iOS Simulator,OS=latest,name=iPhone 14" -quiet clean build
SENTRY_ORG=$SENTRY_ORG_INPUT SENTRY_PROJECT=$SENTRY_PROJECT_INPUT SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN_INPUT xcodebuild -project EmpowerPlant.xcodeproj -scheme EmpowerPlant -configuration Release -derivedDataPath build -destination "platform=iOS Simulator,OS=latest,name=iPhone 15" -quiet clean build
zip -r EmpowerPlant_release.zip ./build/Build/Products/Release-iphonesimulator/EmpowerPlant.app
ZIP_PATH="./EmpowerPlant_release.zip"

Expand Down
5 changes: 5 additions & 0 deletions upload-symbols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"

if [ $CONFIGURATION == 'Test' ]; then
echo "Will not upload debug symbols for test build."
exit 0
fi

if which sentry-cli >/dev/null; then

# get SENTRY_ORG and SENTRY_PROJECT values
Expand Down

0 comments on commit c882ff8

Please sign in to comment.