mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: auto-install codeql on codespace
This commit is contained in:
@@ -5,4 +5,5 @@ FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-ubuntu-22.04
|
||||
|
||||
USER root
|
||||
ADD root.sh /tmp/root.sh
|
||||
ADD update-codeql.sh /usr/local/bin/update-codeql
|
||||
RUN bash /tmp/root.sh && rm /tmp/root.sh
|
||||
|
||||
@@ -17,3 +17,6 @@ curl -fSsL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/rel
|
||||
echo "${BAZELISK_DOWNLOAD_SHA} */usr/local/bin/bazelisk" | sha256sum --check -
|
||||
chmod 0755 /usr/local/bin/bazelisk
|
||||
ln -s bazelisk /usr/local/bin/bazel
|
||||
|
||||
# install latest codeql
|
||||
update-codeql
|
||||
|
||||
14
.devcontainer/swift/update-codeql.sh
Executable file
14
.devcontainer/swift/update-codeql.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
URL=https://github.com/github/codeql-cli-binaries/releases
|
||||
LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' $URL/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
|
||||
CURRENT_VERSION=v$(codeql version 2>/dev/null | sed -ne 's/.*release \([0-9.]*\)\./\1/p')
|
||||
if [[ $CURRENT_VERSION != $LATEST_VERSION ]]; then
|
||||
curl -fSqL -o /tmp/codeql.zip $URL/download/$LATEST_VERSION/codeql-linux64.zip
|
||||
unzip /tmp/codeql.zip -qd /opt
|
||||
rm /tmp/codeql.zip
|
||||
ln -sf /opt/codeql/codeql /usr/local/bin/codeql
|
||||
echo installed version $LATEST_VERSION
|
||||
else
|
||||
echo current version $CURRENT_VERSION is up-to-date
|
||||
fi
|
||||
@@ -11,5 +11,3 @@ bazel run swift/create-extractor-pack
|
||||
#install and set up pre-commit
|
||||
python3 -m pip install pre-commit --no-warn-script-location
|
||||
$HOME/.local/bin/pre-commit install
|
||||
|
||||
cat $(dirname $0)/user_bashrc.sh >> $HOME/.bashrc
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# have the codeql binary installed by vscode automatically in PATH
|
||||
bin=$(ls $HOME/.vscode-remote/data/User/globalStorage/github.vscode-codeql/*/codeql/codeql -t 2>/dev/null | head -1)
|
||||
if [[ -n $bin ]]; then
|
||||
export PATH=$PATH:$(dirname "$bin")
|
||||
fi
|
||||
Reference in New Issue
Block a user