Add support for self-hosted darwin runners

This commit is contained in:
Shivam Mathur 2020-05-06 06:53:25 +05:30
parent 4960e3179f
commit 8830cdd08c
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 28 additions and 34 deletions

34
dist/index.js vendored
View File

@ -354,20 +354,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(__webpack_require__(87)); const os = __webpack_require__(87);
const events = __importStar(__webpack_require__(614)); const events = __webpack_require__(614);
const child = __importStar(__webpack_require__(129)); const child = __webpack_require__(129);
const path = __importStar(__webpack_require__(622)); const path = __webpack_require__(622);
const io = __importStar(__webpack_require__(1)); const io = __webpack_require__(1);
const ioUtil = __importStar(__webpack_require__(672)); const ioUtil = __webpack_require__(672);
/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/unbound-method */
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
/* /*
@ -811,12 +804,6 @@ class ToolRunner extends events.EventEmitter {
resolve(exitCode); resolve(exitCode);
} }
}); });
if (this.options.input) {
if (!cp.stdin) {
throw new Error('child process missing stdin');
}
cp.stdin.end(this.options.input);
}
}); });
}); });
} }
@ -2883,15 +2870,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const tr = __importStar(__webpack_require__(9)); const tr = __webpack_require__(9);
/** /**
* Exec a command. * Exec a command.
* Output will be streamed to the live console. * Output will be streamed to the live console.

View File

@ -178,15 +178,14 @@ update_formulae() {
# Function to setup PHP >=5.6 # Function to setup PHP >=5.6
setup_php() { setup_php() {
action=$1 action=$1
if [ "$version" = "8.0" ]; then
update_formulae
fi
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
brew tap shivammathur/homebrew-php brew tap shivammathur/homebrew-php
if [ "$version" = "5.6" ] || [ "$version" = "7.0" ]; then if brew list php@"$version" 2>/dev/null | grep -q "Error" && [ "$action" != "upgrade" ]; then
brew install https://raw.githubusercontent.com/shivammathur/homebrew-php/master/Formula/icu4c.rb --force brew unlink php@"$version"
else
if [ "$version" = "8.0" ]; then update_formulae; fi
brew "$action" shivammathur/php/php@"$version"
fi fi
brew "$action" shivammathur/php/php@"$version"
brew link --force --overwrite php@"$version" brew link --force --overwrite php@"$version"
} }
@ -198,7 +197,22 @@ nodot_version=${1/./}
old_versions="5.[3-5]" old_versions="5.[3-5]"
tool_path_dir="/usr/local/bin" tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3) existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
[[ -z "${update}" ]] && update='false' || update="${update}" [[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
[ "$runner" = false ] && [[ -n ${RUNNER} ]] && runner="${RUNNER}"
if [ "$runner" = "self-hosted" ]; then
if [[ "$version" =~ $old_versions ]]; then
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
exit 1
fi
if [[ $(command -v brew) == "" ]]; then
step_log "Setup Brew"
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
add_log "$tick" "Brew" "Installed Homebrew"
fi
fi
# Setup PHP # Setup PHP
step_log "Setup PHP" step_log "Setup PHP"