Skip to content

Commit

Permalink
Test action
Browse files Browse the repository at this point in the history
  • Loading branch information
srmukher committed Nov 22, 2023
1 parent 6195a7e commit d54d352
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 9 deletions.
13 changes: 13 additions & 0 deletions tools/UnitTestApp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'node20'
main: 'dist/index.js'
80 changes: 80 additions & 0 deletions tools/UnitTestApp/dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 768:
/***/ ((module) => {

module.exports = eval("require")("@actions/core");


/***/ }),

/***/ 438:
/***/ ((module) => {

module.exports = eval("require")("@actions/github");


/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete __webpack_module_cache__[moduleId];
/******/ }
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
const core = __nccwpck_require__(768);
const github = __nccwpck_require__(438);

try {
// `who-to-greet` input defined in action metadata file
const nameToGreet = core.getInput('who-to-greet');
console.log(`Hello ${nameToGreet}!`);
const time = (new Date()).toTimeString();
core.setOutput("time", time);
// Get the JSON webhook payload for the event that triggered the workflow
const payload = JSON.stringify(github.context.payload, undefined, 2)
console.log(`The event payload: ${payload}`);
} catch (error) {
core.setFailed(error.message);
}
})();

module.exports = __webpack_exports__;
/******/ })()
;
15 changes: 15 additions & 0 deletions tools/UnitTestApp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const core = require('@actions/core');
const github = require('@actions/github');

try {
// `who-to-greet` input defined in action metadata file
const nameToGreet = core.getInput('who-to-greet');
console.log(`Hello ${nameToGreet}!`);
const time = (new Date()).toTimeString();
core.setOutput("time", time);
// Get the JSON webhook payload for the event that triggered the workflow
const payload = JSON.stringify(github.context.payload, undefined, 2)
console.log(`The event payload: ${payload}`);
} catch (error) {
core.setFailed(error.message);
}
30 changes: 21 additions & 9 deletions tools/UnitTestApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,37 @@
"test": "jest"
},
"devDependencies": {
"jest": "29.7.0",
"@types/jest": "29.5.5",
"@fluentui/react-charting": "*",
"@fluentui/theme-samples": "^8.7.119",
"@testing-library/dom": "8.11.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "12.1.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2",
"@types/fs-extra": "8.0.1",
"@types/jest": "29.5.5",
"@types/node": "16.11.7",
"@types/react": "17.0.44",
"@types/react-addons-test-utils": "0.14.18",
"@types/react-dom": "17.0.15",
"@types/react-test-renderer": "17.0.2",
"@types/react-addons-test-utils": "0.14.18",
"@types/rewire": "^2.5.28",
"fs-extra": "8.1.0",
"@types/fs-extra": "8.0.1",
"jest": "29.7.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2",
"rewire": "^4.0.1",
"@types/rewire": "^2.5.28",
"@fluentui/react-charting": "5.18.17"
"typescript": "4.4.4"
},
"exports": {
"./README.md": "./README.md"
},
"jest": {
"setupFilesAfterEnv": [
"<rootDir>/jest.setup.js"
]
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0"
}
}

0 comments on commit d54d352

Please sign in to comment.