Skip to content

Conversation

@alexkappa
Copy link
Contributor

@alexkappa alexkappa commented Jun 22, 2020

Description

Adds an inputs.threads flag to the analyze command. Usage is as follows:

- name: Perform CodeQL Analysis
  uses: github/codeql-action/analyze@v1
  with:
    threads: 4

The value of threads defaults to 1 if is not specified. If specified, will be capped to the vale of os.cpus().length.

Merge / deployment checklist

  • Run test builds as necessary. Can be on this repository or elsewhere as needed in order to test the change - please include links to tests in other repos!
    • CodeQL using init/analyze actions
    • 3rd party tool using upload action
  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

@alexkappa alexkappa force-pushed the add-analyze-threads-flag branch from 6fc27f9 to 2758bd3 Compare June 22, 2020 12:51
@alexkappa alexkappa marked this pull request as ready for review June 22, 2020 15:37
fs.rmdirSync(tmpDir, { recursive: true });
return result;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit odd to move these to util as they are specific to the CodeQL analysis step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, my first instinct was to create a finalize-db.test.ts file and add all relevant test cases in there. That gave me some trouble unfortunately which CodeQL was the only thing that pointed to the problem: the run() function at the end of finalize-db.ts.

Now as to why config.ts in particular, I just saw other similar functions and thought it might be alright.

Ideally I would have liked to have this as follows:

<action-name>/action.yml -> lib/<action-name>.js
lib/<action-name>.js -> lib/<library-or-package>.js

But it would be quite a bigger change and one that merits discussion first. What are your thoughts about this?

@sampart sampart changed the base branch from master to main June 23, 2020 08:56

for (const [input, expectedFlag] of Object.entries(tests)) {

process.env['INPUT_RAM'] = input;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you worked out how to do this. I also added a function to do this at https://github.com/github/codeql-action/blob/main/src/config-utils.test.ts#L8

Would be good to consolidate these into one place. Perhaps we need a new file for utilities for use during tests. Then this function, and withTmpDir could move there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, seems @sampart actually introduced a file like this in https://github.com/github/codeql-action/pull/75/files#diff-2bc785dec81a33ef3bbc6dbe25f2f8c5

For this PR perhaps just ignore this comment then and we'll come back to address stuff in a later PR once all the current ones are merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great, I'll be sure to use that to be more consistent. It would surely give more context.

@alexkappa alexkappa merged commit 98f8945 into main Jun 23, 2020
@github-actions github-actions bot mentioned this pull request Jun 29, 2020
@robertbrignull robertbrignull deleted the add-analyze-threads-flag branch June 30, 2020 09:57
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

Successfully merging this pull request may close these issues.

4 participants