Skip to content

Commit

Permalink
Codeql changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy4040 committed May 27, 2024
1 parent 2103569 commit 20e829c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- run: |
echo "Run, Build Application using script"
./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
36 changes: 36 additions & 0 deletions buildscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status.
set -e

echo "Setting up Go environment"

# Set the Go version. Adjust this to match the version you need.
GO_VERSION="1.19"

# Download and install the specified Go version
echo "Installing Go ${GO_VERSION}"
curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
export PATH="/usr/local/go/bin:$PATH"

# Verify Go installation
go version

# Navigate to the repository root. Adjust if your project structure is different.
cd "$(dirname "$0")/.."

echo "Installing dependencies"
# Install Go modules
go mod download

echo "Building the project"
# Build the project. Adjust the build command if needed.
go build ./...

echo "Running tests"
# Run tests
go test ./...

echo "Build and tests completed successfully"

0 comments on commit 20e829c

Please sign in to comment.