Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Jan 20, 2024
2 parents 28e8a6b + eea91c7 commit a270967
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 13 deletions.
55 changes: 50 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: Build and Test

on: [push, workflow_dispatch]

env:
XC_VERSION: ${{ '15.1' }}
CCACHE_COMPRESS: "true"
CCACHE_COMPRESSLEVEL: "10"
CCACHE_MAXSIZE: "400M"

jobs:

unit-tests:
runs-on: macos-13
env:
XC_VERSION: ${{ '15.1' }}
CCACHE_COMPRESS: "true"
CCACHE_COMPRESSLEVEL: "10"
CCACHE_MAXSIZE: "400M"
strategy:
matrix:
configuration: ["Debug", "Release", "ASAN"]
Expand Down Expand Up @@ -44,3 +48,44 @@ jobs:
echo "Done"
env:
GH_TOKEN: ${{ github.token }}

build-unsigned:
runs-on: macos-13
steps:
- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"
- name: Install deps
run: |
brew install ccache
brew install create-dmg
- name: Cache ccache
uses: actions/cache@v2
with:
path: ~/Library/Caches/ccache
key: ccache-${{ github.job }}-${{ github.run_id }}
restore-keys: ccache-${{ github.job }}
- uses: actions/checkout@v2
- name: Build and package
run: "cd Scripts && ./build_unsigned.sh"
- name: Show ccache stats
run: "ccache --show-stats --verbose"
- name: Remove old ccache caches
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeys=$(gh actions-cache list --key ccache-${{ github.job }}- | cut -f 1 )
# Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeys
do
gh actions-cache delete $cacheKey --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
- uses: actions/upload-artifact@v4
with:
name: nimble-commander-unsigned
path: Scripts/*.dmg
if-no-files-found: error
74 changes: 74 additions & 0 deletions Scripts/build_unsigned.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/sh

set -e
set -o pipefail

if ! [ -x "$(command -v xcpretty)" ] ; then
echo 'xcpretty is not found, aborting. (https://github.com/xcpretty/xcpretty)'
exit -1
fi

if ! [ -x "$(command -v create-dmg)" ] ; then
echo 'create-dmg is not found, aborting. (https://github.com/create-dmg/create-dmg)'
exit -1
fi

# https://github.com/xcpretty/xcpretty/issues/48
export LC_CTYPE=en_US.UTF-8

# get current directory
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# allocate a temp dir for build artifacts
BUILD_DIR=$(mktemp -d ${SCRIPTS_DIR}/build_unsigned.tmp)

# all builds paths will be relative to ROOT_DIR
ROOT_DIR=$(cd "$SCRIPTS_DIR/.." && pwd)

XCODEPROJ="../Source/NimbleCommander/NimbleCommander.xcodeproj"

PBUDDY=/usr/libexec/PlistBuddy

if type -p /usr/local/bin/ccache >/dev/null 2>&1; then
echo Using ccache
export CCACHE_BASEDIR="${ROOT_DIR}"
export CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,file_stat_matches
export CC="${SCRIPTS_DIR}/ccache-clang"
export CXX="${SCRIPTS_DIR}/ccache-clang++"
fi

XC="xcodebuild \
-project ${XCODEPROJ} \
-scheme NimbleCommander-NonMAS \
-configuration Release \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGN_IDENTITY= \
DEVELOPMENT_TEAM= \
PROVISIONING_PROFILE_SPECIFIER= \
CODE_SIGN_ENTITLEMENTS= \
SYMROOT=${BUILD_DIR} \
OBJROOT=${BUILD_DIR} \
OTHER_CFLAGS=\"-fdebug-prefix-map=${ROOT_DIR}=.\""

APP_DIR=$($XC -showBuildSettings | grep " BUILT_PRODUCTS_DIR =" | sed -e 's/.*= *//' )
APP_NAME=$($XC -showBuildSettings | grep " FULL_PRODUCT_NAME =" | sed -e 's/.*= *//' )
APP_PATH=$APP_DIR/$APP_NAME

$XC build | xcpretty

cp -R "${APP_PATH}" ./

VERSION=$( $PBUDDY -c "Print CFBundleShortVersionString" "$APP_PATH/Contents/Info.plist" )
BUILD=$( $PBUDDY -c "Print CFBundleVersion" "$APP_PATH/Contents/Info.plist" )

create-dmg \
--volname "Nimble Commander Unsigned" \
--window-pos 200 200 \
--window-size 610 386 \
--background "dmg/background.png" \
--text-size 12 \
--icon-size 128 \
--icon "${APP_NAME}" 176 192 \
--app-drop-link 432 192 \
"nimble-commander-unsigned-${VERSION}(${BUILD}).dmg" \
"${APP_NAME}"
Binary file added Scripts/dmg/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions Source/NimbleCommander/NimbleCommander.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3731,7 +3731,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "codesign --verbose --sign 'Developer ID Application' --force --deep --timestamp --options runtime \"${CODESIGNING_FOLDER_PATH}/Contents/Frameworks/Sparkle.framework/Resources/Autoupdate.app\"\ncodesign --verbose --sign 'Developer ID Application' --force --deep --timestamp --options runtime \"${CODESIGNING_FOLDER_PATH}/Contents/Frameworks/Sparkle.framework\"\n";
shellScript = "if [[ $CODE_SIGNING_ALLOWED -eq NO ]] ; then exit ; fi\ncodesign --verbose --sign 'Developer ID Application' --force --deep --timestamp --options runtime \"${CODESIGNING_FOLDER_PATH}/Contents/Frameworks/Sparkle.framework/Resources/Autoupdate.app\"\ncodesign --verbose --sign 'Developer ID Application' --force --deep --timestamp --options runtime \"${CODESIGNING_FOLDER_PATH}/Contents/Frameworks/Sparkle.framework\"\n";
};
CF9EEB3E17256372001443FA /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -5202,10 +5202,6 @@
buildSettings = {
CODE_SIGN_IDENTITY = "";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)_Unsigned";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/3rd_Party/Sparkle",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__NC_VERSION_TRIAL__=1",
Expand All @@ -5221,11 +5217,10 @@
buildSettings = {
CODE_SIGN_IDENTITY = "";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)_Unsigned";
FRAMEWORK_SEARCH_PATHS = (
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"$(PROJECT_DIR)/3rd_Party/Sparkle",
"__NC_VERSION_TRIAL__=1",
);
GCC_PREPROCESSOR_DEFINITIONS = "__NC_VERSION_TRIAL__=1";
INFOPLIST_FILE = "NimbleCommander/Resources/NimbleCommander-CI-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = info.filesmanager.Files;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down

0 comments on commit a270967

Please sign in to comment.