Skip to content

Commit 96b50d1

Browse files
First pass fixing CI/CD issues
1 parent e57089a commit 96b50d1

3 files changed

Lines changed: 87 additions & 2 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Install CodeQL library pack dependencies
2+
description: |
3+
Downloads any necessary CodeQL library packs needed by packs in the repo.
4+
inputs:
5+
cli_path:
6+
description: |
7+
The path to the CodeQL CLI directory.
8+
required: false
9+
10+
mode:
11+
description: |
12+
The `--mode` option to `codeql pack install`.
13+
required: true
14+
default: verify
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install CodeQL library packs
20+
shell: bash
21+
env:
22+
CODEQL_CLI: ${{ inputs.cli_path }}
23+
run: |
24+
PATH=$PATH:$CODEQL_CLI
25+
python scripts/install-packs.py --mode ${{ inputs.mode }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Setup CodeQL CLI
2+
description: |
3+
Install a CodeQL CLI or re-use an existing one from the cache and it to the path.
4+
5+
outputs:
6+
codeql-cli-version:
7+
description: "The version of the CodeQL CLI that was installed or retrieved from cache"
8+
value: ${{ steps.codeql-version.outputs.codeql-cli-version }}
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: "CodeQL Version"
14+
id: codeql-version
15+
shell: bash
16+
run: |
17+
echo "Reading CodeQL CLI version from .codeqlversion file."
18+
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
19+
echo "CODEQL_CLI_VERSION=${CODEQL_CLI_VERSION}" >> $GITHUB_ENV
20+
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT
21+
22+
- name: Cache CodeQL
23+
id: cache-codeql
24+
uses: actions/cache@v4
25+
with:
26+
# A list of files, directories, and wildcard patterns to cache and restore
27+
path: ${{github.workspace}}/codeql_home
28+
# An explicit key for restoring and saving the cache
29+
key: codeql-home-${{ steps.codeql-version.outputs.codeql-cli-version }}
30+
31+
- name: Install CodeQL
32+
id: install-codeql
33+
if: steps.cache-codeql.outputs.cache-hit != 'true'
34+
shell: bash
35+
env:
36+
GITHUB_TOKEN: ${{ github.token }}
37+
CODEQL_HOME: ${{ github.workspace }}/codeql_home
38+
CODEQL_CLI_VERSION: ${{ steps.codeql-version.outputs.codeql-cli-version }}
39+
run: |
40+
echo "Installing CodeQL CLI v${CODEQL_CLI_VERSION}."
41+
42+
mkdir -p $CODEQL_HOME
43+
echo "Change directory to $CODEQL_HOME"
44+
pushd $CODEQL_HOME
45+
46+
echo "Downloading CodeQL CLI v${CODEQL_CLI_VERSION}."
47+
gh release download "v${CODEQL_CLI_VERSION}" --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
48+
49+
echo "Unzipping CodeQL CLI."
50+
unzip -q codeql-linux64.zip
51+
52+
popd
53+
echo "Done."
54+
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT
55+
56+
- name: Add CodeQL to the PATH
57+
shell: bash
58+
env:
59+
CODEQL_HOME: ${{ github.workspace }}/codeql_home
60+
run: |
61+
echo "Adding CodeQL CLI to the PATH."
62+
echo "$CODEQL_HOME/codeql" >> $GITHUB_PATH

.github/workflows/codeql-query-format.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
uses: ./.github/actions/install-codeql
2222

2323
- name: Validate query format
24-
env:
25-
LANGUAGE: ${{ matrix.language }}
2624
run: |
2725
codeql version
2826
find . \( -name \*.ql -or -name \*.qll \) -print0 | xargs -0 --max-procs "$XARGS_MAX_PROCS" codeql query format --in-place

0 commit comments

Comments
 (0)