Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codeqlversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.20.1
24 changes: 19 additions & 5 deletions .github/actions/install-codeql/action.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
name: Setup CodeQL CLI
description: |
Install a CodeQL CLI or re-use an existing one from the cache and it to the path.
inputs:

outputs:
codeql-cli-version:
description: |
The version of the CodeQL CLI to be downloaded.
description: "The version of the CodeQL CLI that was installed or retrieved from cache"
value: ${{ steps.codeql-version.outputs.codeql-cli-version }}

runs:
using: composite
steps:
- name: "CodeQL Version"
id: codeql-version
shell: bash
run: |
echo "Reading CodeQL CLI version from .codeqlversion file."
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
echo "CODEQL_CLI_VERSION=${CODEQL_CLI_VERSION}" >> $GITHUB_ENV
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{github.workspace}}/codeql_home
# An explicit key for restoring and saving the cache
key: codeql-home-${{ inputs.codeql-cli-version }}
key: codeql-home-${{ steps.codeql-version.outputs.codeql-cli-version }}

- name: Install CodeQL
id: install-codeql
if: steps.cache-codeql.outputs.cache-hit != 'true'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
CODEQL_HOME: ${{ github.workspace }}/codeql_home
CODEQL_CLI_VERSION: ${{ inputs.codeql-cli-version }}
CODEQL_CLI_VERSION: ${{ steps.codeql-version.outputs.codeql-cli-version }}
run: |
echo "Installing CodeQL CLI v${CODEQL_CLI_VERSION}."

mkdir -p $CODEQL_HOME
echo "Change directory to $CODEQL_HOME"
pushd $CODEQL_HOME
Expand All @@ -38,6 +51,7 @@ runs:

popd
echo "Done."
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT

- name: Add CodeQL to the PATH
shell: bash
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches: [ main ]
workflow_dispatch:

env:
CODEQL_CLI_VERSION: 2.20.1

jobs:
compile-and-test:
runs-on: ubuntu-latest
Expand All @@ -31,15 +28,14 @@ jobs:

- name: Setup CodeQL
if: steps.changes.outputs.src == 'true'
id: install-codeql
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Install Packs
if: steps.changes.outputs.src == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
CODEQL_CLI_VERSION: ${{ env.CODEQL_CLI_VERSION }}
CODEQL_CLI_VERSION: ${{ steps.install-codeql.outputs.codeql-cli-version }}
run: |
gh repo clone github/codeql -- -b codeql-cli-${CODEQL_CLI_VERSION} # to make stubs available for tests
codeql pack install "${{ matrix.language }}/lib"
Expand Down Expand Up @@ -175,8 +171,6 @@ jobs:
- name: Setup CodeQL
if: steps.changes.outputs.src == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Install Packs
if: steps.changes.outputs.src == 'true'
Expand Down Expand Up @@ -210,8 +204,6 @@ jobs:
- name: Setup CodeQL
if: steps.changes.outputs.src == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Install CodeQL
if: steps.changes.outputs.src == 'true'
Expand All @@ -238,14 +230,10 @@ jobs:
- name: Setup CodeQL
if: steps.changes.outputs.src == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: "Check Configurations"
if: steps.changes.outputs.src == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
./.github/scripts/pr-configs.sh "${{ github.event.number }}"


10 changes: 0 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: [main]
workflow_dispatch:

env:
CODEQL_CLI_VERSION: 2.20.1

jobs:
queries:
Expand Down Expand Up @@ -42,8 +40,6 @@ jobs:
- name: Setup CodeQL
if: steps.check_version.outputs.publish == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Publish codeql-LANG-queries (src) pack.
if: steps.check_version.outputs.publish == 'true'
Expand Down Expand Up @@ -87,8 +83,6 @@ jobs:
- name: Setup CodeQL
if: steps.check_version.outputs.publish == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Publish codeql-LANG-libs (lib) pack
if: steps.check_version.outputs.publish == 'true'
Expand Down Expand Up @@ -131,8 +125,6 @@ jobs:
- name: Setup CodeQL
if: steps.check_version.outputs.publish == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Publish codeql-LANG-extensions (ext) pack
if: steps.check_version.outputs.publish == 'true'
Expand Down Expand Up @@ -176,8 +168,6 @@ jobs:
- name: Setup CodeQL
if: steps.check_version.outputs.publish == 'true'
uses: ./.github/actions/install-codeql
with:
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}

- name: Publish codeql-LANG-library-sources (ext-library-sources) pack
if: steps.check_version.outputs.publish == 'true'
Expand Down