Skip to content

Commit 98104d8

Browse files
authored
Merge branch 'main' into chore/--build
2 parents 781da98 + 79c79f1 commit 98104d8

File tree

105 files changed

+1323
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1323
-603
lines changed

.github/workflows/pr-checks.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ jobs:
5959
mv ../action/tests/multi-language-repo/{*,.github} .
6060
mv ../action/.github/workflows .github
6161
- uses: ./../action/init
62+
with:
63+
db-location: "${{ runner.temp }}/customDbLocation"
6264
- name: Build code
6365
shell: bash
6466
run: ./build.sh
6567
- uses: ./../action/analyze
6668
env:
6769
TEST_MODE: true
6870
- run: |
69-
cd "$RUNNER_TEMP/codeql_databases"
71+
cd "$RUNNER_TEMP/customDbLocation"
7072
# List all directories as there will be precisely one directory per database
7173
# but there may be other files in this directory such as query suites.
7274
if [ "$(ls -d */ | wc -l)" != 6 ] || \
@@ -261,6 +263,12 @@ jobs:
261263
- uses: ./../action/analyze
262264
env:
263265
TEST_MODE: true
266+
- run: |
267+
cd "$RUNNER_TEMP/codeql_databases"
268+
if [[ ! -d go ]]; then
269+
echo "Did not find a Go database"
270+
exit 1
271+
fi
264272
265273
multi-language-repo_rubocop:
266274
needs: [check-js, check-node-modules]
@@ -465,8 +473,10 @@ jobs:
465473
466474
- name: Build code
467475
shell: powershell
476+
# Note we want to make sure that the .win32env file is read correctly, so we unset the CODEQL_EXTRACTOR_CSHARP_ROOT from the .sh file.
468477
run: |
469478
cat ./codeql-runner/codeql-env.sh | Invoke-Expression
479+
$Env:CODEQL_EXTRACTOR_CSHARP_ROOT = ""
470480
& $Env:CODEQL_RUNNER dotnet build
471481
472482
- name: Run analyze

.github/workflows/python-deps.yml

Lines changed: 66 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,18 @@ on:
66
pull_request:
77

88
jobs:
9-
109
test-setup-python-scripts:
1110
runs-on: ${{ matrix.os }}
1211
strategy:
1312
fail-fast: false
1413
matrix:
1514
os: [ubuntu-latest, macos-latest]
16-
include:
17-
- test_dir: python-setup/tests/pipenv/requests-2
18-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
19-
- test_dir: python-setup/tests/pipenv/requests-3
20-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
21-
22-
- test_dir: python-setup/tests/poetry/requests-2
23-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
24-
- test_dir: python-setup/tests/poetry/requests-3
25-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
26-
27-
- test_dir: python-setup/tests/requirements/requests-2
28-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
29-
- test_dir: python-setup/tests/requirements/requests-3
30-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
31-
32-
- test_dir: python-setup/tests/setup_py/requests-2
33-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
34-
- test_dir: python-setup/tests/setup_py/requests-3
35-
test_script: $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
36-
37-
# This one shouldn't fail, but also won't install packages
38-
- test_dir: python-setup/tests/requirements/non-standard-location
39-
test_script: test -z $LGTM_INDEX_IMPORT_PATH
15+
python_deps_type: [pipenv, poetry, requirements, setup_py]
16+
python_version: [2, 3]
17+
18+
env:
19+
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
20+
PYTHON_VERSION: ${{ matrix.python_version }}
4021

4122
steps:
4223
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
@@ -55,7 +36,7 @@ jobs:
5536
set -x
5637
$GITHUB_WORKSPACE/python-setup/install_tools.sh
5738
58-
cd $GITHUB_WORKSPACE/${{ matrix.test_dir }}
39+
cd $GITHUB_WORKSPACE/python-setup/tests/${PYTHON_DEPS_TYPE}/requests-${PYTHON_VERSION}
5940
6041
case ${{ matrix.os }} in
6142
ubuntu-latest*) basePath="/opt";;
@@ -71,35 +52,69 @@ jobs:
7152
if [ ! -z $CODEQL_PYTHON ]; then
7253
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
7354
fi
55+
7456
- name: Verify packages installed
7557
run: |
76-
${{ matrix.test_script }}
58+
$GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh ${PYTHON_VERSION}
59+
60+
# This one shouldn't fail, but also won't install packages
61+
test-setup-python-scripts-non-standard-location:
62+
runs-on: ${{ matrix.os }}
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
os: [ubuntu-latest, macos-latest]
67+
68+
steps:
69+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
70+
- uses: actions/checkout@v2
71+
72+
- name: Initialize CodeQL
73+
uses: ./init
74+
id: init
75+
with:
76+
tools: latest
77+
languages: python
78+
setup-python-dependencies: false
79+
80+
- name: Test Auto Package Installation
81+
run: |
82+
set -x
83+
$GITHUB_WORKSPACE/python-setup/install_tools.sh
84+
85+
cd $GITHUB_WORKSPACE/python-setup/tests/requirements/non-standard-location
86+
87+
case ${{ matrix.os }} in
88+
ubuntu-latest*) basePath="/opt";;
89+
macos-latest*) basePath="/Users/runner";;
90+
esac
91+
echo ${basePath}
92+
93+
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
94+
95+
- name: Setup for extractor
96+
run: |
97+
echo $CODEQL_PYTHON
98+
# only run if $CODEQL_PYTHON is set
99+
if [ ! -z $CODEQL_PYTHON ]; then
100+
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
101+
fi
102+
103+
- name: Verify packages installed
104+
run: |
105+
test -z $LGTM_INDEX_IMPORT_PATH
77106
78107
test-setup-python-scripts-windows:
79108
runs-on: windows-latest
80109
strategy:
81110
fail-fast: false
82111
matrix:
83-
include:
84-
- test_dir: python-setup/tests/pipenv/requests-2
85-
python_version: 2
86-
- test_dir: python-setup/tests/pipenv/requests-3
87-
python_version: 3
88-
89-
- test_dir: python-setup/tests/poetry/requests-2
90-
python_version: 2
91-
- test_dir: python-setup/tests/poetry/requests-3
92-
python_version: 3
93-
94-
- test_dir: python-setup/tests/requirements/requests-2
95-
python_version: 2
96-
- test_dir: python-setup/tests/requirements/requests-3
97-
python_version: 3
98-
99-
- test_dir: python-setup/tests/setup_py/requests-2
100-
python_version: 2
101-
- test_dir: python-setup/tests/setup_py/requests-3
102-
python_version: 3
112+
python_deps_type: [pipenv, poetry, requirements, setup_py]
113+
python_version: [2, 3]
114+
115+
env:
116+
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
117+
PYTHON_VERSION: ${{ matrix.python_version }}
103118

104119
steps:
105120
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
@@ -117,17 +132,19 @@ jobs:
117132
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1"
118133
powershell -File $cmd
119134
120-
cd $Env:GITHUB_WORKSPACE\\${{ matrix.test_dir }}
135+
cd $Env:GITHUB_WORKSPACE\\python-setup/tests/$Env:PYTHON_DEPS_TYPE/requests-$Env:PYTHON_VERSION
121136
$DefaultsPath = Join-Path (Join-Path $Env:GITHUB_WORKSPACE "src") "defaults.json"
122137
$CodeQLBundleName = (Get-Content -Raw -Path $DefaultsPath | ConvertFrom-Json).bundleVersion
123138
$CodeQLVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1]
124139
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py C:\\hostedtoolcache\\windows\\CodeQL\\$CodeQLVersion\\x64\\codeql
140+
125141
- name: Setup for extractor
126142
run: |
127143
echo $Env:CODEQL_PYTHON
128144
129145
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON
146+
130147
- name: Verify packages installed
131148
run: |
132149
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_123.ps1"
133-
powershell -File $cmd ${{ matrix.python_version }}
150+
powershell -File $cmd $Env:PYTHON_VERSION

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "typescript",
6+
"tsconfig": "tsconfig.json",
7+
"option": "watch",
8+
"problemMatcher": [
9+
"$tsc-watch"
10+
],
11+
"group": "build",
12+
"label": "tsc: watch - tsconfig.json"
13+
}
14+
]
15+
}

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ Before you start, ensure that you have a recent version of node installed. You c
2222

2323
This project also includes configuration to run tests from VSCode (with support for breakpoints) - open the test file you wish to run and choose "Debug AVA test file" from the Run menu in the Run panel.
2424

25+
You may want to run `tsc --watch` from the command line or inside of vscode in order to ensure build artifacts are up to date as you are working.
26+
27+
### Checking in compiled artifacts and `node_modules`
28+
29+
Because CodeQL Action users consume the code directly from this repository, and there can be no build step during an GitHub Actions run, this repository contains all compiled artifacts and node modules. There is a PR check that will fail if any of the compiled artifacts are not up to date. Compiled artifacts are stored in the `lib/` directory. For all day-to-day development purposes, this folder can be ignored.
30+
31+
Only run `npm install` if you are explicitly changing the set of dependencies in `package.json`. The `node_modules` directory should be up to date when you check out, but if for some reason, there is an inconsistency use `npm ci && npm run removeNPMAbsolutePaths` to ensure the directory is in a state consistent with the `package-lock.json`. There is a PR check to ensure the consistency of the `node_modules` directory.
32+
2533
### Running the action
2634

2735
To see the effect of your changes and to test them, push your changes in a branch and then look at the [Actions output](https://github.com/github/codeql-action/actions) for that branch. You can also exercise the code locally by running the automated tests.

analyze/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ inputs:
2727
description: "The path at which the analyzed repository was checked out. Used to relativize any absolute paths in the uploaded SARIF file."
2828
required: false
2929
default: ${{ github.workspace }}
30+
category:
31+
description: String used by Code Scanning for matching the analyses
32+
required: false
3033
token:
3134
default: ${{ github.token }}
3235
matrix:

init/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
config-file:
1717
description: Path of the config file to use
1818
required: false
19+
db-location:
20+
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
21+
required: false
1922
queries:
2023
description: Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file; prefix with "+" to use both sets of queries.
2124
required: false

lib/actions-util.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)