Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Transpiled JavaScript action is always failing #957

Open
minsis opened this issue Oct 16, 2024 · 3 comments
Open

Check Transpiled JavaScript action is always failing #957

minsis opened this issue Oct 16, 2024 · 3 comments
Assignees

Comments

@minsis
Copy link

minsis commented Oct 16, 2024

The Transpiled action that gets packaged with this template is always failing on matching license.txt. When running the diff command locally it seems to be passing fine and running any builds yields the same license.txt file.

Example: https://github.com/irunasroot/action-awx-template/actions/runs/11310967681/job/31456639532

@ncalteen
Copy link
Collaborator

I tested with the repo you linked and do see a difference in the licenses.txt file after running the package script. When you run npm run all locally, do you see any changes to that file?

@ncalteen ncalteen self-assigned this Oct 21, 2024
@minsis
Copy link
Author

minsis commented Oct 22, 2024

No, it doesn't change the license.txt file. I even removed the file and regenerated it and it just generates as the same exact file. The odd thing is I built a new action with the same exact packages but yet license.txt was fine there. 🤷 I'm guessing this really isn't related to this repo in general but I just added it here as a reference I guess. From what I'm reading in some cases it has to do with line endings with Windows users with the testing in Linux containers, but all my line endings are set to LF in VSCode plus I'm not on Windows.

Here's my output if you see anything interesting.

➜  action-awx-template git:(releases/v1) npm run all

> [email protected] all
> npm run format:write && npm run lint && npm run test && npm run coverage && npm run package


> [email protected] format:write
> npx prettier --write .

__tests__/controller.test.ts 146ms (unchanged)
__tests__/index.test.ts 12ms (unchanged)
__tests__/job_template.test.ts 69ms (unchanged)
__tests__/main.test.ts 24ms (unchanged)
__tests__/mock_data/controller.ts 7ms (unchanged)
__tests__/mock_data/job_launch.ts 11ms (unchanged)
__tests__/mock_data/job_output.ts 6ms (unchanged)
__tests__/mock_data/job_requirements.ts 5ms (unchanged)
__tests__/mock_data/job_status_nodes.ts 26ms (unchanged)
__tests__/mock_data/job_status.ts 18ms (unchanged)
__tests__/mock_data/job_template_input.ts 14ms (unchanged)
__tests__/mock_data/job_template.ts 20ms (unchanged)
__tests__/mock_data/workflow_nodes.ts 9ms (unchanged)
__tests__/mock_functions/getInput.ts 12ms (unchanged)
__tests__/workflow_job_template.test.ts 32ms (unchanged)
.devcontainer/devcontainer.json 23ms (unchanged)
.github/dependabot.yml 26ms (unchanged)
.github/linters/.markdown-lint.yml 6ms (unchanged)
.github/linters/.yaml-lint.yml 2ms (unchanged)
.github/linters/eslint.config.mjs 16ms (unchanged)
.github/linters/tsconfig.eslint.json 2ms (unchanged)
.github/workflows/check-dist.yml 6ms (unchanged)
.github/workflows/ci.yml 4ms (unchanged)
.github/workflows/codeql-analysis.yml 9ms (unchanged)
.github/workflows/linter.yml 4ms (unchanged)
.prettierrc.json 1ms (unchanged)
action.yml 17ms (unchanged)
package-lock.json 64ms (unchanged)
package.json 3ms (unchanged)
README.md 55ms (unchanged)
src/index.ts 2ms (unchanged)
src/main.ts 19ms (unchanged)
src/models/api.ts 38ms (unchanged)
src/models/index.ts 5ms (unchanged)
src/models/job_template.ts 26ms (unchanged)
src/models/workflow_job_template.ts 13ms (unchanged)
tsconfig.json 2ms (unchanged)

> [email protected] lint
> npx eslint . -c ./.github/linters/eslint.config.mjs

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=4.7.4 <5.6.0

YOUR TYPESCRIPT VERSION: 5.6.3

Please only submit bug reports when using the officially supported version.

=============

/Users/dwhitney/Documents/Projects/action-awx-template/__tests__/mock_data/job_template_input.ts
   40:3  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   50:3  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  109:3  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/dwhitney/Documents/Projects/action-awx-template/src/main.ts
    4:38  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   95:23  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  125:33  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  193:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/dwhitney/Documents/Projects/action-awx-template/src/models/api.ts
   51:25  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   76:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   87:22  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   95:72  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  102:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  107:73  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  123:22  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  129:47  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  133:55  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  137:64  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  157:51  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  176:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  177:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  197:57  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  204:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/dwhitney/Documents/Projects/action-awx-template/src/models/job_template.ts
    4:36  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   25:15  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   35:25  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   51:17  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   61:27  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  108:50  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  204:20  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  229:20  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/dwhitney/Documents/Projects/action-awx-template/src/models/workflow_job_template.ts
    4:36  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   16:15  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   31:17  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   66:50  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  136:20  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  153:22  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  179:40  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  180:24  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 38 problems (0 errors, 38 warnings)


> [email protected] test
> npx jest

 PASS  __tests__/index.test.ts
  index
    ✓ calls run when imported (45 ms)

 PASS  __tests__/job_template.test.ts (5.144 s)
  Testing Job Template Initializations
    ✓ Job Template invalid ID (41 ms)
  Job Template Validations
    ✓ Pass all validations - no requirements (2 ms)
    ✓ Pass all validation - with requirements (1 ms)
    ✓ Fail validation - with requirements (1 ms)
    ✓ Pass survey validation (1 ms)
    ✓ Fail survey validation - some missing variables
    ✓ Fail survey validation - extra_vars empty (2 ms)
    ✓ Fail survey validation - extra_vars null
    ✓ Pass credentials passwords validation (1 ms)
    ✓ Fail credentials passwords validation - some missing (3 ms)
    ✓ Fail credentials passwords validation - credential_passwords empty (2 ms)
    ✓ Fail credentials passwords validation - credential_passwords null (2 ms)
  Job Template run function
    ✓ Pass run function (1 ms)
    ✓ Fail run function

 PASS  __tests__/main.test.ts (5.145 s)
  Test main run function
    ✓ Testing run with Job Template (6 ms)
    ✓ Testing run with Workflow Job Template (2 ms)
    ✓ Testing run with missing template IDs (1 ms)
    ✓ Testing run with wrong job_type (1 ms)
    ✓ Testing run with wrong verbosity level

 PASS  __tests__/controller.test.ts (5.166 s)
  Testing Controller Initializations
    ✓ Controller invalid URL protocol (25 ms)
    ✓ Controller http protocol
    ✓ Controller missing URL (1 ms)
    ✓ Controller URL w/path (1 ms)
    ✓ Controller URL w/slash (1 ms)
    ✓ Controller missing credentials (1 ms)
    ✓ Controller specify username/password (1 ms)
    ✓ Controller specify token (1 ms)
  Testing with Job Template Data
    ✓ Getting launch requirements data (1 ms)
    ✓ Fail getting launch requirements data (5 ms)
    ✓ Getting job status (1 ms)
    ✓ Fail getting job status (2 ms)
    ✓ Getting job output - ansi (1 ms)
    ✓ Getting job output - txt
    ✓ Getting job output - json (1 ms)
    ✓ Fail getting job output - ansi (1 ms)
    ✓ Fail getting job output - txt (1 ms)
    ✓ Launch job template - no payload (1 ms)
    ✓ Fail launch job template - no payload
  Testing with Workflow Job Template Data
    ✓ Getting launch requirements data (1 ms)
    ✓ Fail getting launch requirements data
    ✓ Getting workflow job status
    ✓ Fail getting workflow job status (1 ms)
    ✓ Getting workflow job nodes (1 ms)
    ✓ Fail getting workflow job nodes (1 ms)
    ✓ Launch workflow job template - no payload
    ✓ Fail launch workflow job template - no payload
  Testing miscellaneous functions
    ✓ Testing sleep function (1 ms)

 PASS  __tests__/workflow_job_template.test.ts (5.171 s)
  Testing Workflow Job Template Initializations
    ✓ Workflow Job Template invalid ID (24 ms)
  Workflow Job Template Validations
    ✓ Pass all validations - no requirements (2 ms)
    ✓ Pass all validation - with requirements
    ✓ Fail all validation - with requirements (1 ms)
    ✓ Pass survey validation (3 ms)
    ✓ Fail survey validation - some missing variables (1 ms)
    ✓ Fail survey validation - extra_vars empty (1 ms)
    ✓ Fail survey validation - extra_vars null
  Workflow Job Template run function
    ✓ Pass run function (1 ms)
    ✓ Fail run function (3 ms)

---------------------------|---------|----------|---------|---------|-------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------------|---------|----------|---------|---------|-------------------
All files                  |     100 |      100 |     100 |     100 |                   
 src                       |     100 |      100 |     100 |     100 |                   
  index.ts                 |     100 |      100 |     100 |     100 |                   
  main.ts                  |     100 |      100 |     100 |     100 |                   
 src/models                |     100 |      100 |     100 |     100 |                   
  api.ts                   |     100 |      100 |     100 |     100 |                   
  index.ts                 |     100 |      100 |     100 |     100 |                   
  job_template.ts          |     100 |      100 |     100 |     100 |                   
  workflow_job_template.ts |     100 |      100 |     100 |     100 |                   
---------------------------|---------|----------|---------|---------|-------------------
Test Suites: 5 passed, 5 total
Tests:       58 passed, 58 total
Snapshots:   0 total
Time:        5.684 s
Ran all test suites.

> [email protected] coverage
> npx make-coverage-badge --output-path ./badges/coverage.svg

Wrote coverage badge to: ./badges/coverage.svg

> [email protected] package
> npx ncc build src/index.ts -o dist --source-map --license licenses.txt

ncc: Version 0.38.2
ncc: Compiling file index.js into CJS
ncc: Using [email protected] (local user-provided)
  22kB  dist/licenses.txt
  40kB  dist/sourcemap-register.js
1330kB  dist/index.js
1386kB  dist/index.js.map
1386kB  dist/index.js.map
2778kB  [3182ms] - ncc 0.38.2

@ncalteen
Copy link
Collaborator

I've personally had a bit more luck and consistency with rollup for packaging TypeScript actions. I will keep this issue open and possibly convert this repo to use that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants