├── tests └── .gitkeep ├── .eslintignore ├── .prettierignore ├── src ├── input-settings.ts ├── main.ts ├── input-helper.ts └── executor.ts ├── .prettierrc.json ├── jest.config.js ├── tsconfig.json ├── CHANGELOG.md ├── action.yml ├── LICENSE ├── package.json ├── CONTRIBUTING.md ├── .gitignore ├── .eslintrc.json ├── README.md └── dist └── index.js /tests/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | lib/ 3 | node_modules/ -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | lib/ 3 | node_modules/ -------------------------------------------------------------------------------- /src/input-settings.ts: -------------------------------------------------------------------------------- 1 | export interface InputSettings { 2 | ignoreFiles: string[]; 3 | useGitRoot: boolean; 4 | mainDir: string; 5 | path: string; 6 | package: string; 7 | file: string; 8 | } 9 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "arrowParens": "avoid", 10 | "parser": "typescript" 11 | } -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testEnvironment: 'node', 5 | testMatch: ['**/*.test.ts'], 6 | testRunner: 'jest-circus/runner', 7 | transform: { 8 | '^.+\\.ts$': 'ts-jest' 9 | }, 10 | verbose: true 11 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "noImplicitAny": true, 9 | "esModuleInterop": true 10 | }, 11 | "exclude": ["node_modules", "**/*.test.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.1.1 4 | 5 | Ignore dart files containing "part of" directive by defauly, since these files cannot be imported. 6 | 7 | ## 1.0.5 8 | 9 | See 1.0.4. 10 | 11 | ## 1.0.4 12 | 13 | Add `use_git_root` and `main_dir` action parameters. 14 | 15 | ## 1.0.3 16 | 17 | Updated README.md 18 | 19 | ## 1.0.2 20 | 21 | Fix a bug with improper buildCommand script. 22 | 23 | ## 1.0.1 24 | 25 | Official release. 26 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import * as inputHelper from './input-helper'; 3 | import { execute } from './executor'; 4 | import { InputSettings } from './input-settings'; 5 | 6 | async function run(): Promise { 7 | try { 8 | const settings: InputSettings = inputHelper.getInputs(); 9 | execute(settings); 10 | } catch (error) { 11 | core.setFailed(error.message); 12 | } 13 | } 14 | 15 | run(); 16 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Dart Full Coverage' 2 | description: 'Action for allowing coverage test tool to find all Dart files' 3 | branding: 4 | icon: trending-up 5 | color: green 6 | inputs: 7 | package: 8 | description: 'Package name as used in imports' 9 | required: true 10 | ignore: 11 | description: 'List of files to ignore, separated by comma' 12 | required: false 13 | default: '' 14 | path: 15 | description: 'Path, relative to directory root' 16 | required: false 17 | default: 'lib' 18 | test_file: 19 | description: 'Path to test file that will be created, relative to directory root' 20 | required: false 21 | default: 'test/coverage_helper_test.dart' 22 | 23 | runs: 24 | using: 'node12' 25 | main: 'dist/index.js' -------------------------------------------------------------------------------- /src/input-helper.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import { InputSettings } from './input-settings'; 3 | 4 | /** 5 | * Gets the inputs from user's workflow file. 6 | * 7 | * @return {InputSettings} an object with user's settings 8 | */ 9 | export function getInputs(): InputSettings { 10 | const ignore: string = core.getInput('ignore'); 11 | const useGitWorkspaceRoot: string = core.getInput('use_git_root'); 12 | const mainDirectory: string = core.getInput('main_dir'); 13 | const relativePath: string = core.getInput('path'); 14 | const packageName: string = core.getInput('package'); 15 | const testFile: string = core.getInput('test_file'); 16 | 17 | const inputSettings: InputSettings = { 18 | ignoreFiles: ignore.split(',').map((value: string) => value.trim()), 19 | useGitRoot: useGitWorkspaceRoot === 'false' ? false : true, 20 | mainDir: mainDirectory, 21 | path: relativePath.trim(), 22 | package: packageName, 23 | file: testFile 24 | }; 25 | 26 | return inputSettings; 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 stelynx 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@stelynx/dart-full-coverage", 3 | "version": "1.1.1", 4 | "private": false, 5 | "description": "A GitHub Actions action for allowing coverage test tool to see all Dart files", 6 | "main": "lib/main.js", 7 | "scripts": { 8 | "build": "tsc", 9 | "format": "prettier --write **/*.ts", 10 | "format-check": "prettier --check **/*.ts", 11 | "lint": "eslint src/**/*.ts", 12 | "pack": "ncc build", 13 | "test": "jest", 14 | "all": "npm run build && npm run format && npm run lint && npm run pack && npm test" 15 | }, 16 | "keywords": [ 17 | "dart", 18 | "flutter", 19 | "coverage", 20 | "github", 21 | "action" 22 | ], 23 | "author": "Stelynx", 24 | "license": "MIT", 25 | "homepage": "https://github.com/stelynx/dart-full-coverage", 26 | "dependencies": { 27 | "@actions/core": "^1.2.3" 28 | }, 29 | "devDependencies": { 30 | "@types/jest": "^24.0.23", 31 | "@types/node": "^12.7.12", 32 | "@typescript-eslint/parser": "^2.8.0", 33 | "@zeit/ncc": "^0.20.5", 34 | "eslint": "^6.8.0", 35 | "eslint-plugin-github": "^2.0.0", 36 | "eslint-plugin-jest": "^22.21.0", 37 | "jest": "^24.9.0", 38 | "jest-circus": "^24.9.0", 39 | "js-yaml": "^3.13.1", 40 | "prettier": "^1.19.1", 41 | "ts-jest": "^24.2.0", 42 | "typescript": "^3.6.4" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/executor.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import * as childProcess from 'child_process'; 3 | import { InputSettings } from './input-settings'; 4 | 5 | export function execute(settings: InputSettings): void { 6 | const cmd = buildCommand(settings); 7 | 8 | core.info(`\nExecuting command:\n${cmd}`); 9 | childProcess.exec( 10 | cmd, 11 | ( 12 | error: childProcess.ExecException | null, 13 | stdout: string, 14 | stderr: string 15 | ) => { 16 | if (error) core.setFailed(error.message); 17 | core.info(stdout); 18 | core.error(stderr); 19 | } 20 | ); 21 | } 22 | 23 | function buildCommand(settings: InputSettings): string { 24 | let excludeString = ''; 25 | for (const str of settings.ignoreFiles) { 26 | excludeString += `-and -not -name '${str}' `; 27 | } 28 | 29 | let changeDirStr = ''; 30 | if (settings.useGitRoot) { 31 | changeDirStr += 'cd $GITHUB_WORKSPACE && '; 32 | } else if (settings.mainDir?.length > 0) { 33 | changeDirStr += `cd ${settings.mainDir} && `; 34 | } 35 | 36 | return `${changeDirStr}echo "// ignore_for_file: unused_import" > ${ 37 | settings.file 38 | } && find ${ 39 | settings.path 40 | } -name '*.dart' ${excludeString.trim()} -exec grep -L "part of" {} \\; | cut -c4- | awk '{printf "import '\\''package:${ 41 | settings.package 42 | }%s'\\'';\\n", $1}' >> ${settings.file} && echo "void main(){}" >> ${ 43 | settings.file 44 | } && echo "\nProcessing completed. Output file in ${ 45 | settings.file 46 | }:\n" && cat ${settings.file}`; 47 | } 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to *Dart Full Coverage* 2 | 3 | Every contribution to project is very welcome, but please follow the rules below. 4 | 5 | ## Opening an issue 6 | 7 | If you have a feature request, bug report, or question, you can open a new issue. Before you open it, please check if such isssue does not yet exist. 8 | 9 | When you open an issue that 10 | 11 | - reports a bug, please use **bug** label for the issue and start the title of the issue with **"SLDFC-#: "**, where # denotes the **current issue number** (that is not a number including pull requests you see automatically generated by GitHub). For example, if action would not load and the latest numbered issue was "SLDFC-15", open an issue titled "SLDFC-16: Action would not load". 12 | - requests a feature, please use **feature** label for the issue and title the issue the same as described in the previous point. 13 | - posts a question, label issue with **question** and **do not** use numbering in the title like you would in the bug or feature request case. Just title the issue with question. 14 | 15 | ## Opening a pull request 16 | 17 | You are also very welcomed to open a pull request with your own contribution. However, before you open a pull request, please open an issue describing what is the bug or what feature are you implementing in pull request (**follow the rules above!**). Once you opened the issue, you can submit your pull request. 18 | 19 | When you submit a pull request 20 | 21 | - title it the same as issue, 22 | - reference the issue in pull request's body using any of the closing keywords, "Resolves" prefered. 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | jspm_packages/ 46 | 47 | # TypeScript v1 declaration files 48 | typings/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional REPL history 60 | .node_repl_history 61 | 62 | # Output of 'npm pack' 63 | *.tgz 64 | 65 | # Yarn Integrity file 66 | .yarn-integrity 67 | 68 | # dotenv environment variables file 69 | .env 70 | .env.test 71 | 72 | # parcel-bundler cache (https://parceljs.org/) 73 | .cache 74 | 75 | # next.js build output 76 | .next 77 | 78 | # nuxt.js build output 79 | .nuxt 80 | 81 | # vuepress build output 82 | .vuepress/dist 83 | 84 | # Serverless directories 85 | .serverless/ 86 | 87 | # FuseBox cache 88 | .fusebox/ 89 | 90 | # DynamoDB Local files 91 | .dynamodb/ 92 | 93 | # OS metadata 94 | .DS_Store 95 | Thumbs.db 96 | 97 | # Ignore built ts files 98 | __tests__/runner/* 99 | lib/**/* -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["jest", "@typescript-eslint"], 3 | "extends": ["plugin:github/es6"], 4 | "parser": "@typescript-eslint/parser", 5 | "parserOptions": { 6 | "ecmaVersion": 9, 7 | "sourceType": "module", 8 | "project": "./tsconfig.json" 9 | }, 10 | "rules": { 11 | "eslint-comments/no-use": "off", 12 | "import/no-namespace": "off", 13 | "no-unused-vars": "off", 14 | "@typescript-eslint/no-unused-vars": "error", 15 | "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], 16 | "@typescript-eslint/no-require-imports": "error", 17 | "@typescript-eslint/array-type": "error", 18 | "@typescript-eslint/await-thenable": "error", 19 | "@typescript-eslint/ban-ts-ignore": "error", 20 | "camelcase": "off", 21 | "@typescript-eslint/camelcase": "error", 22 | "@typescript-eslint/class-name-casing": "error", 23 | "@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], 24 | "@typescript-eslint/func-call-spacing": ["error", "never"], 25 | "@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"], 26 | "@typescript-eslint/no-array-constructor": "error", 27 | "@typescript-eslint/no-empty-interface": "error", 28 | "@typescript-eslint/no-explicit-any": "error", 29 | "@typescript-eslint/no-extraneous-class": "error", 30 | "@typescript-eslint/no-for-in-array": "error", 31 | "@typescript-eslint/no-inferrable-types": "error", 32 | "@typescript-eslint/no-misused-new": "error", 33 | "@typescript-eslint/no-namespace": "error", 34 | "@typescript-eslint/no-non-null-assertion": "warn", 35 | "@typescript-eslint/no-object-literal-type-assertion": "error", 36 | "@typescript-eslint/no-unnecessary-qualifier": "error", 37 | "@typescript-eslint/no-unnecessary-type-assertion": "error", 38 | "@typescript-eslint/no-useless-constructor": "error", 39 | "@typescript-eslint/no-var-requires": "error", 40 | "@typescript-eslint/prefer-for-of": "warn", 41 | "@typescript-eslint/prefer-function-type": "warn", 42 | "@typescript-eslint/prefer-includes": "error", 43 | "@typescript-eslint/prefer-interface": "error", 44 | "@typescript-eslint/prefer-string-starts-ends-with": "error", 45 | "@typescript-eslint/promise-function-async": "error", 46 | "@typescript-eslint/require-array-sort-compare": "error", 47 | "@typescript-eslint/restrict-plus-operands": "error", 48 | "semi": "off", 49 | "@typescript-eslint/semi": ["error", "always"], 50 | "@typescript-eslint/type-annotation-spacing": "error", 51 | "@typescript-eslint/unbound-method": "error" 52 | }, 53 | "env": { 54 | "node": true, 55 | "es6": true, 56 | "jest/globals": true 57 | } 58 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dart Full Coverage 2 | 3 | ![npm](https://img.shields.io/npm/v/@stelynx/dart-full-coverage) 4 | ![GitHub](https://img.shields.io/github/license/stelynx/dart-full-coverage) 5 | 6 | Coverage tools like _codecov_ only see the files that were actually triggered by tests. This means 7 | that a coverage of 100% can easily be a lie, e.g. you can just write a dummy test that does not import 8 | any files and a coverage tool will ignore all the code base. 9 | 10 | Luckily, this action resolves this problem. 11 | 12 | ## How it works 13 | 14 | The _Dart Full Coverage_ action harvests the power of Bash to find all files in specified directory, by 15 | default it is `lib` directory, where all Flutter files are. It then creates a dummy test file 16 | `test/coverage_helper_test.dart` that imports all the Dart files that were found and has an empty `void main() {}` 17 | function so that it actually starts. 18 | 19 | ## Using the action 20 | 21 | Action has four parameters: 22 | 23 | - `package`: The name of your package, the same as you use in imports, e.g. if you import files like 24 | `import "package:egakcap/some_file.dart";`, then package is `'egakcap'`. This parameter is required. 25 | - `use_git_root`: Boolean, whether to `cd` into `$GITHUB_WORKSPACE` at the beginning of the script or not. Defaults to true, set `use_git_root: false` to negate. 26 | - `main_dir`: If `use_git_root` is set to `false`, you can provide the starting directory where the script should `cd` to. If `use_git_root` is set to `false` and you omit this value, the active directory will not be changed. 27 | - `path`: The relative path to Dart files, by default it is `'lib'`. Path is relative to either `$GITHUB_WORKSPACE`, or provided directory in `main_dir`, or to the directory the action is being executed in. 28 | - `test_file`: The name of the dummy file the script will create. The name should lead to where your tests are. The default value is `'test/coverage_helper_test.dart'`. 29 | - `ignore`: A comma-separated list of files to be ignored and not imported in `test_file`. For example, if you want to skip all files that end with "\_state.dart" or the file is called "do_not_import_me.dart", then set `ignore` to `'*_state.dart, do_not_import_me.dart'`. By default, none of the files will be ignored. 30 | 31 | So, a typical usage of this action would be similar to the following. 32 | 33 | ```yaml 34 | name: "test" 35 | on: push 36 | 37 | jobs: 38 | build: 39 | runs-on: ubuntu-latest 40 | steps: 41 | - uses: actions/checkout@v1 42 | - uses: actions/setup-java@v1 43 | with: 44 | java-version: "12.x" 45 | - uses: subosito/flutter-action@v1 46 | with: 47 | channel: "stable" 48 | - uses: stelynx/dart-full-coverage@v1.1.1 49 | with: 50 | package: egakcap 51 | ignore: "*_state.dart, do_not_import_me.dart" 52 | - run: flutter pub get 53 | - run: flutter packages pub run build_runner build 54 | - run: flutter build aot 55 | - run: flutter analyze 56 | - run: flutter test --coverage . 57 | - uses: codecov/codecov-action@v1.0.2 58 | with: 59 | token: ${{ secrets.CODECOV_TOKEN }} 60 | ``` 61 | 62 | ## Contributing 63 | 64 | Every contribution is very welcome! Please, see the [CONTRIBUTING guidlines](CONTRIBUTING.md). 65 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules, runtime) { // webpackBootstrap 3 | /******/ "use strict"; 4 | /******/ // The module cache 5 | /******/ var installedModules = {}; 6 | /******/ 7 | /******/ // The require function 8 | /******/ function __webpack_require__(moduleId) { 9 | /******/ 10 | /******/ // Check if module is in cache 11 | /******/ if(installedModules[moduleId]) { 12 | /******/ return installedModules[moduleId].exports; 13 | /******/ } 14 | /******/ // Create a new module (and put it into the cache) 15 | /******/ var module = installedModules[moduleId] = { 16 | /******/ i: moduleId, 17 | /******/ l: false, 18 | /******/ exports: {} 19 | /******/ }; 20 | /******/ 21 | /******/ // Execute the module function 22 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 23 | /******/ 24 | /******/ // Flag the module as loaded 25 | /******/ module.l = true; 26 | /******/ 27 | /******/ // Return the exports of the module 28 | /******/ return module.exports; 29 | /******/ } 30 | /******/ 31 | /******/ 32 | /******/ __webpack_require__.ab = __dirname + "/"; 33 | /******/ 34 | /******/ // the startup function 35 | /******/ function startup() { 36 | /******/ // Load entry module and return exports 37 | /******/ return __webpack_require__(198); 38 | /******/ }; 39 | /******/ 40 | /******/ // run startup 41 | /******/ return startup(); 42 | /******/ }) 43 | /************************************************************************/ 44 | /******/ ({ 45 | 46 | /***/ 87: 47 | /***/ (function(module) { 48 | 49 | module.exports = require("os"); 50 | 51 | /***/ }), 52 | 53 | /***/ 129: 54 | /***/ (function(module) { 55 | 56 | module.exports = require("child_process"); 57 | 58 | /***/ }), 59 | 60 | /***/ 130: 61 | /***/ (function(__unusedmodule, exports, __webpack_require__) { 62 | 63 | "use strict"; 64 | 65 | var __importStar = (this && this.__importStar) || function (mod) { 66 | if (mod && mod.__esModule) return mod; 67 | var result = {}; 68 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 69 | result["default"] = mod; 70 | return result; 71 | }; 72 | Object.defineProperty(exports, "__esModule", { value: true }); 73 | const core = __importStar(__webpack_require__(470)); 74 | const childProcess = __importStar(__webpack_require__(129)); 75 | function execute(settings) { 76 | const cmd = buildCommand(settings); 77 | core.info(`\nExecuting command:\n${cmd}`); 78 | childProcess.exec(cmd, (error, stdout, stderr) => { 79 | if (error) 80 | core.setFailed(error.message); 81 | core.info(stdout); 82 | core.error(stderr); 83 | }); 84 | } 85 | exports.execute = execute; 86 | function buildCommand(settings) { 87 | var _a; 88 | let excludeString = ''; 89 | for (const str of settings.ignoreFiles) { 90 | excludeString += `-and -not -name '${str}' `; 91 | } 92 | let changeDirStr = ''; 93 | if (settings.useGitRoot) { 94 | changeDirStr += 'cd $GITHUB_WORKSPACE && '; 95 | } 96 | else if (((_a = settings.mainDir) === null || _a === void 0 ? void 0 : _a.length) > 0) { 97 | changeDirStr += `cd ${settings.mainDir} && `; 98 | } 99 | return `${changeDirStr}echo "// ignore_for_file: unused_import" > ${settings.file} && find ${settings.path} -name '*.dart' ${excludeString.trim()} -exec grep -L "part of" {} \\; | cut -c4- | awk '{printf "import '\\''package:${settings.package}%s'\\'';\\n", $1}' >> ${settings.file} && echo "void main(){}" >> ${settings.file} && echo "\nProcessing completed. Output file in ${settings.file}:\n" && cat ${settings.file}`; 100 | } 101 | 102 | 103 | /***/ }), 104 | 105 | /***/ 198: 106 | /***/ (function(__unusedmodule, exports, __webpack_require__) { 107 | 108 | "use strict"; 109 | 110 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 111 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 112 | return new (P || (P = Promise))(function (resolve, reject) { 113 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 114 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 115 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 116 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 117 | }); 118 | }; 119 | var __importStar = (this && this.__importStar) || function (mod) { 120 | if (mod && mod.__esModule) return mod; 121 | var result = {}; 122 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 123 | result["default"] = mod; 124 | return result; 125 | }; 126 | Object.defineProperty(exports, "__esModule", { value: true }); 127 | const core = __importStar(__webpack_require__(470)); 128 | const inputHelper = __importStar(__webpack_require__(821)); 129 | const executor_1 = __webpack_require__(130); 130 | function run() { 131 | return __awaiter(this, void 0, void 0, function* () { 132 | try { 133 | const settings = inputHelper.getInputs(); 134 | executor_1.execute(settings); 135 | } 136 | catch (error) { 137 | core.setFailed(error.message); 138 | } 139 | }); 140 | } 141 | run(); 142 | 143 | 144 | /***/ }), 145 | 146 | /***/ 431: 147 | /***/ (function(__unusedmodule, exports, __webpack_require__) { 148 | 149 | "use strict"; 150 | 151 | var __importStar = (this && this.__importStar) || function (mod) { 152 | if (mod && mod.__esModule) return mod; 153 | var result = {}; 154 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 155 | result["default"] = mod; 156 | return result; 157 | }; 158 | Object.defineProperty(exports, "__esModule", { value: true }); 159 | const os = __importStar(__webpack_require__(87)); 160 | /** 161 | * Commands 162 | * 163 | * Command Format: 164 | * ::name key=value,key=value::message 165 | * 166 | * Examples: 167 | * ::warning::This is the message 168 | * ::set-env name=MY_VAR::some value 169 | */ 170 | function issueCommand(command, properties, message) { 171 | const cmd = new Command(command, properties, message); 172 | process.stdout.write(cmd.toString() + os.EOL); 173 | } 174 | exports.issueCommand = issueCommand; 175 | function issue(name, message = '') { 176 | issueCommand(name, {}, message); 177 | } 178 | exports.issue = issue; 179 | const CMD_STRING = '::'; 180 | class Command { 181 | constructor(command, properties, message) { 182 | if (!command) { 183 | command = 'missing.command'; 184 | } 185 | this.command = command; 186 | this.properties = properties; 187 | this.message = message; 188 | } 189 | toString() { 190 | let cmdStr = CMD_STRING + this.command; 191 | if (this.properties && Object.keys(this.properties).length > 0) { 192 | cmdStr += ' '; 193 | let first = true; 194 | for (const key in this.properties) { 195 | if (this.properties.hasOwnProperty(key)) { 196 | const val = this.properties[key]; 197 | if (val) { 198 | if (first) { 199 | first = false; 200 | } 201 | else { 202 | cmdStr += ','; 203 | } 204 | cmdStr += `${key}=${escapeProperty(val)}`; 205 | } 206 | } 207 | } 208 | } 209 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 210 | return cmdStr; 211 | } 212 | } 213 | function escapeData(s) { 214 | return (s || '') 215 | .replace(/%/g, '%25') 216 | .replace(/\r/g, '%0D') 217 | .replace(/\n/g, '%0A'); 218 | } 219 | function escapeProperty(s) { 220 | return (s || '') 221 | .replace(/%/g, '%25') 222 | .replace(/\r/g, '%0D') 223 | .replace(/\n/g, '%0A') 224 | .replace(/:/g, '%3A') 225 | .replace(/,/g, '%2C'); 226 | } 227 | //# sourceMappingURL=command.js.map 228 | 229 | /***/ }), 230 | 231 | /***/ 470: 232 | /***/ (function(__unusedmodule, exports, __webpack_require__) { 233 | 234 | "use strict"; 235 | 236 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 237 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 238 | return new (P || (P = Promise))(function (resolve, reject) { 239 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 240 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 241 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 242 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 243 | }); 244 | }; 245 | var __importStar = (this && this.__importStar) || function (mod) { 246 | if (mod && mod.__esModule) return mod; 247 | var result = {}; 248 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 249 | result["default"] = mod; 250 | return result; 251 | }; 252 | Object.defineProperty(exports, "__esModule", { value: true }); 253 | const command_1 = __webpack_require__(431); 254 | const os = __importStar(__webpack_require__(87)); 255 | const path = __importStar(__webpack_require__(622)); 256 | /** 257 | * The code to exit an action 258 | */ 259 | var ExitCode; 260 | (function (ExitCode) { 261 | /** 262 | * A code indicating that the action was successful 263 | */ 264 | ExitCode[ExitCode["Success"] = 0] = "Success"; 265 | /** 266 | * A code indicating that the action was a failure 267 | */ 268 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 269 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 270 | //----------------------------------------------------------------------- 271 | // Variables 272 | //----------------------------------------------------------------------- 273 | /** 274 | * Sets env variable for this action and future actions in the job 275 | * @param name the name of the variable to set 276 | * @param val the value of the variable 277 | */ 278 | function exportVariable(name, val) { 279 | process.env[name] = val; 280 | command_1.issueCommand('set-env', { name }, val); 281 | } 282 | exports.exportVariable = exportVariable; 283 | /** 284 | * Registers a secret which will get masked from logs 285 | * @param secret value of the secret 286 | */ 287 | function setSecret(secret) { 288 | command_1.issueCommand('add-mask', {}, secret); 289 | } 290 | exports.setSecret = setSecret; 291 | /** 292 | * Prepends inputPath to the PATH (for this action and future actions) 293 | * @param inputPath 294 | */ 295 | function addPath(inputPath) { 296 | command_1.issueCommand('add-path', {}, inputPath); 297 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 298 | } 299 | exports.addPath = addPath; 300 | /** 301 | * Gets the value of an input. The value is also trimmed. 302 | * 303 | * @param name name of the input to get 304 | * @param options optional. See InputOptions. 305 | * @returns string 306 | */ 307 | function getInput(name, options) { 308 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 309 | if (options && options.required && !val) { 310 | throw new Error(`Input required and not supplied: ${name}`); 311 | } 312 | return val.trim(); 313 | } 314 | exports.getInput = getInput; 315 | /** 316 | * Sets the value of an output. 317 | * 318 | * @param name name of the output to set 319 | * @param value value to store 320 | */ 321 | function setOutput(name, value) { 322 | command_1.issueCommand('set-output', { name }, value); 323 | } 324 | exports.setOutput = setOutput; 325 | //----------------------------------------------------------------------- 326 | // Results 327 | //----------------------------------------------------------------------- 328 | /** 329 | * Sets the action status to failed. 330 | * When the action exits it will be with an exit code of 1 331 | * @param message add error issue message 332 | */ 333 | function setFailed(message) { 334 | process.exitCode = ExitCode.Failure; 335 | error(message); 336 | } 337 | exports.setFailed = setFailed; 338 | //----------------------------------------------------------------------- 339 | // Logging Commands 340 | //----------------------------------------------------------------------- 341 | /** 342 | * Gets whether Actions Step Debug is on or not 343 | */ 344 | function isDebug() { 345 | return process.env['RUNNER_DEBUG'] === '1'; 346 | } 347 | exports.isDebug = isDebug; 348 | /** 349 | * Writes debug message to user log 350 | * @param message debug message 351 | */ 352 | function debug(message) { 353 | command_1.issueCommand('debug', {}, message); 354 | } 355 | exports.debug = debug; 356 | /** 357 | * Adds an error issue 358 | * @param message error issue message 359 | */ 360 | function error(message) { 361 | command_1.issue('error', message); 362 | } 363 | exports.error = error; 364 | /** 365 | * Adds an warning issue 366 | * @param message warning issue message 367 | */ 368 | function warning(message) { 369 | command_1.issue('warning', message); 370 | } 371 | exports.warning = warning; 372 | /** 373 | * Writes info to log with console.log. 374 | * @param message info message 375 | */ 376 | function info(message) { 377 | process.stdout.write(message + os.EOL); 378 | } 379 | exports.info = info; 380 | /** 381 | * Begin an output group. 382 | * 383 | * Output until the next `groupEnd` will be foldable in this group 384 | * 385 | * @param name The name of the output group 386 | */ 387 | function startGroup(name) { 388 | command_1.issue('group', name); 389 | } 390 | exports.startGroup = startGroup; 391 | /** 392 | * End an output group. 393 | */ 394 | function endGroup() { 395 | command_1.issue('endgroup'); 396 | } 397 | exports.endGroup = endGroup; 398 | /** 399 | * Wrap an asynchronous function call in a group. 400 | * 401 | * Returns the same type as the function itself. 402 | * 403 | * @param name The name of the group 404 | * @param fn The function to wrap in the group 405 | */ 406 | function group(name, fn) { 407 | return __awaiter(this, void 0, void 0, function* () { 408 | startGroup(name); 409 | let result; 410 | try { 411 | result = yield fn(); 412 | } 413 | finally { 414 | endGroup(); 415 | } 416 | return result; 417 | }); 418 | } 419 | exports.group = group; 420 | //----------------------------------------------------------------------- 421 | // Wrapper action state 422 | //----------------------------------------------------------------------- 423 | /** 424 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 425 | * 426 | * @param name name of the state to store 427 | * @param value value to store 428 | */ 429 | function saveState(name, value) { 430 | command_1.issueCommand('save-state', { name }, value); 431 | } 432 | exports.saveState = saveState; 433 | /** 434 | * Gets the value of an state set by this action's main execution. 435 | * 436 | * @param name name of the state to get 437 | * @returns string 438 | */ 439 | function getState(name) { 440 | return process.env[`STATE_${name}`] || ''; 441 | } 442 | exports.getState = getState; 443 | //# sourceMappingURL=core.js.map 444 | 445 | /***/ }), 446 | 447 | /***/ 622: 448 | /***/ (function(module) { 449 | 450 | module.exports = require("path"); 451 | 452 | /***/ }), 453 | 454 | /***/ 821: 455 | /***/ (function(__unusedmodule, exports, __webpack_require__) { 456 | 457 | "use strict"; 458 | 459 | var __importStar = (this && this.__importStar) || function (mod) { 460 | if (mod && mod.__esModule) return mod; 461 | var result = {}; 462 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 463 | result["default"] = mod; 464 | return result; 465 | }; 466 | Object.defineProperty(exports, "__esModule", { value: true }); 467 | const core = __importStar(__webpack_require__(470)); 468 | /** 469 | * Gets the inputs from user's workflow file. 470 | * 471 | * @return {InputSettings} an object with user's settings 472 | */ 473 | function getInputs() { 474 | const ignore = core.getInput('ignore'); 475 | const useGitWorkspaceRoot = core.getInput('use_git_root'); 476 | const mainDirectory = core.getInput('main_dir'); 477 | const relativePath = core.getInput('path'); 478 | const packageName = core.getInput('package'); 479 | const testFile = core.getInput('test_file'); 480 | const inputSettings = { 481 | ignoreFiles: ignore.split(',').map((value) => value.trim()), 482 | useGitRoot: useGitWorkspaceRoot === 'false' ? false : true, 483 | mainDir: mainDirectory, 484 | path: relativePath.trim(), 485 | package: packageName, 486 | file: testFile 487 | }; 488 | return inputSettings; 489 | } 490 | exports.getInputs = getInputs; 491 | 492 | 493 | /***/ }) 494 | 495 | /******/ }); --------------------------------------------------------------------------------