@@ -1072,7 +1072,7 @@ const os = __webpack_require__(87);
10721072const path = __webpack_require__(622);
10731073const fs = __webpack_require__(747);
10741074const Utils = __webpack_require__(353);
1075- const ArtifactsManager = __webpack_require__(513 );
1075+ const ArtifactsManager = __webpack_require__(275 );
10761076const constants = __webpack_require__(613);
10771077
10781078const {
@@ -1107,15 +1107,21 @@ class BinaryControl {
11071107 * platform and the architecture
11081108 */
11091109 _decidePlatformAndBinary() {
1110- if (this.platform === PLATFORMS.DARWIN) {
1111- this.binaryLink = BINARY_LINKS.DARWIN;
1112- this.binaryFolder = path.resolve(process.env.HOME, 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1113- } else if (this.platform === PLATFORMS.LINUX) {
1114- this.binaryLink = os.arch() === 'x32' ? BINARY_LINKS.LINUX_32 : BINARY_LINKS.LINUX_64;
1115- this.binaryFolder = path.resolve(process.env.HOME, 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1116- } else if (this.platform === PLATFORMS.WIN32) {
1117- this.binaryLink = BINARY_LINKS.WINDOWS;
1118- this.binaryFolder = path.resolve(process.env.GITHUB_WORKSPACE, '..', '..', 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1110+ switch (this.platform) {
1111+ case PLATFORMS.DARWIN:
1112+ this.binaryLink = BINARY_LINKS.DARWIN;
1113+ this.binaryFolder = path.resolve(process.env.HOME, 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1114+ break;
1115+ case PLATFORMS.LINUX:
1116+ this.binaryLink = os.arch() === 'x32' ? BINARY_LINKS.LINUX_32 : BINARY_LINKS.LINUX_64;
1117+ this.binaryFolder = path.resolve(process.env.HOME, 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1118+ break;
1119+ case PLATFORMS.WIN32:
1120+ this.binaryLink = BINARY_LINKS.WINDOWS;
1121+ this.binaryFolder = path.resolve(process.env.GITHUB_WORKSPACE, '..', '..', 'work', 'binary', LOCAL_BINARY_FOLDER, this.platform);
1122+ break;
1123+ default:
1124+ throw Error(`Unsupported Platform: ${this.platform}. No BrowserStackLocal binary found.`);
11191125 }
11201126 }
11211127
@@ -1205,11 +1211,11 @@ class BinaryControl {
12051211 * Downloads the Local Binary, extracts it and adds it in the PATH variable
12061212 */
12071213 async downloadBinary() {
1214+ if (Utils.checkToolInCache(LOCAL_BINARY_NAME)) {
1215+ core.info('BrowserStackLocal binary already exists in cache. Using that instead of downloading again...');
1216+ return;
1217+ }
12081218 try {
1209- if (Utils.checkToolInCache(LOCAL_BINARY_NAME)) {
1210- core.info('BrowserStackLocal binary already exists in cache. Using that instead of downloading again...');
1211- return;
1212- }
12131219 await this._makeDirectory();
12141220 core.info('Downloading BrowserStackLocal binary...');
12151221 const downloadPath = await tc.downloadTool(this.binaryLink, path.resolve(this.binaryFolder, 'binaryZip'));
@@ -4986,6 +4992,40 @@ class Context {
49864992exports.Context = Context;
49874993//# sourceMappingURL=context.js.map
49884994
4995+ /***/ }),
4996+
4997+ /***/ 275:
4998+ /***/ (function(module, __unusedexports, __webpack_require__) {
4999+
5000+ const artifact = __webpack_require__(214);
5001+ const core = __webpack_require__(470);
5002+
5003+ class ArtifactsManager {
5004+ /**
5005+ * Upload artifacts to GitHub workflow
5006+ * @param {String} artifactName Name by which the artifact should be available post uploading
5007+ * @param {String[]} files Files to upload
5008+ * @param {String} rootFolder Folder in which the files reside
5009+ * @returns {Promise<artifact.UploadResponse>} Response of the upload operation
5010+ */
5011+ static async uploadArtifacts(artifactName, files, rootFolder) {
5012+ const artifactClient = artifact.create();
5013+ const response = await artifactClient.uploadArtifact(
5014+ artifactName,
5015+ files,
5016+ rootFolder, {
5017+ continueOnError: true,
5018+ },
5019+ );
5020+ core.info(`Response for upload: ${JSON.stringify(response)}`);
5021+ return response;
5022+ }
5023+ }
5024+
5025+ // eslint-disable-next-line import/prefer-default-export
5026+ module.exports = ArtifactsManager;
5027+
5028+
49895029/***/ }),
49905030
49915031/***/ 280:
@@ -11143,40 +11183,6 @@ function addHook (state, kind, name, hook) {
1114311183}
1114411184
1114511185
11146- /***/ }),
11147-
11148- /***/ 513:
11149- /***/ (function(module, __unusedexports, __webpack_require__) {
11150-
11151- const artifact = __webpack_require__(214);
11152- const core = __webpack_require__(470);
11153-
11154- class ArtifactsManager {
11155- /**
11156- * Upload artifacts to GitHub workflow
11157- * @param {String} artifactName Name by which the artifact should be available post uploading
11158- * @param {String[]} files Files to upload
11159- * @param {String} rootFolder Folder in which the files reside
11160- * @returns {Promise<artifact.UploadResponse>} Response of the upload operation
11161- */
11162- static async uploadArtifacts(artifactName, files, rootFolder) {
11163- const artifactClient = artifact.create();
11164- const response = await artifactClient.uploadArtifact(
11165- artifactName,
11166- files,
11167- rootFolder, {
11168- continueOnError: true,
11169- },
11170- );
11171- core.info(`Response for upload: ${JSON.stringify(response)}`);
11172- return response;
11173- }
11174- }
11175-
11176- // eslint-disable-next-line import/prefer-default-export
11177- module.exports = ArtifactsManager;
11178-
11179-
1118011186/***/ }),
1118111187
1118211188/***/ 521:
@@ -13975,8 +13981,8 @@ const {
1397513981 * Entry point to initiate the Action.
1397613982 * 1. Triggers parsing of action input values
1397713983 * 2. Decides requirement of Local Binary
13978- * 3. Start/Stop Local Binary if required
13979- * 4. Triggers uploading of artifacts
13984+ * 3. Start/Stop Local Binary
13985+ * 4. Triggers uploading of artifacts after stopping binary
1398013986 */
1398113987const run = async () => {
1398213988 try {
@@ -16953,7 +16959,7 @@ class ActionInput {
1695316959
1695416960 /**
1695516961 * Triggers conditional validation of action input values based on the operation
16956- * to be performed, i.e. start/no local connection required, stopping of local connection
16962+ * to be performed, i.e. starting/ stopping of local connection
1695716963 */
1695816964 _validateInput() {
1695916965 this.localTesting = InputValidator.validateLocalTesting(this.localTesting);
0 commit comments