mirror of
https://github.com/github/codeql.git
synced 2026-01-29 22:32:58 +01:00
Also download OS-specific zip files while we're at it. There are two files in `codeql-win64.zip` called `codeql/codeql` and `codeql/codeql.exe`. Because of the order they were put into the zip, they come out in the order `codeql/codeql.exe` followed by `codeql/codeql`, and something on Windows thinks that the second file has the same name as the first. It's because it's trying to emulate linux and running `codeql/codeql` could run either one of them. We need to make sure we definitely have the `.exe` file, so we explicitly extract it again afterwards. This workaround is already used in some other places. The order that the zip file is made in has now been fixed so this shouldn't be a problem for future releases, so this workaround can be removed in future.
144 lines
4.0 KiB
YAML
144 lines
4.0 KiB
YAML
name: CodeQL tests
|
|
on: [pull_request]
|
|
jobs:
|
|
|
|
test-linux:
|
|
name: Test Linux (Ubuntu)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go 1.16
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.16
|
|
id: go
|
|
|
|
- name: Set up CodeQL CLI
|
|
run: |
|
|
echo "Removing old CodeQL Directory..."
|
|
rm -rf $HOME/codeql
|
|
echo "Done"
|
|
cd $HOME
|
|
echo "Downloading CodeQL CLI..."
|
|
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
|
|
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
|
|
echo "Done"
|
|
echo "Unpacking CodeQL CLI..."
|
|
unzip -q codeql-linux64.zip
|
|
rm -f codeql-linux64.zip
|
|
echo "Done"
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Enable problem matchers in repository
|
|
shell: bash
|
|
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
|
|
|
|
- name: Build
|
|
run: env PATH=$PATH:$HOME/codeql make
|
|
|
|
- name: Check that all QL and Go code is autoformatted
|
|
run: env PATH=$PATH:$HOME/codeql make check-formatting
|
|
|
|
- name: Compile qhelp files to markdown
|
|
run: env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
|
|
|
|
- name: Upload qhelp markdown
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: qhelp-markdown
|
|
path: qhelp-out/**/*.md
|
|
|
|
- name: Test
|
|
run: env PATH=$PATH:$HOME/codeql make test
|
|
|
|
test-mac:
|
|
name: Test MacOS
|
|
runs-on: macOS-latest
|
|
steps:
|
|
- name: Set up Go 1.16
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.16
|
|
id: go
|
|
|
|
- name: Set up CodeQL CLI
|
|
run: |
|
|
echo "Removing old CodeQL Directory..."
|
|
rm -rf $HOME/codeql
|
|
echo "Done"
|
|
cd $HOME
|
|
echo "Downloading CodeQL CLI..."
|
|
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
|
|
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-osx64.zip "$LATEST"
|
|
echo "Done"
|
|
echo "Unpacking CodeQL CLI..."
|
|
unzip -q codeql-osx64.zip
|
|
rm -f codeql-osx64.zip
|
|
echo "Done"
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Enable problem matchers in repository
|
|
shell: bash
|
|
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
|
|
|
|
- name: Build
|
|
run: env PATH=$PATH:$HOME/codeql make
|
|
|
|
- name: Test
|
|
run: env PATH=$PATH:$HOME/codeql make test
|
|
|
|
test-win:
|
|
name: Test Windows
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Set up Go 1.16
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.16
|
|
id: go
|
|
|
|
- name: Set up CodeQL CLI
|
|
run: |
|
|
echo "Removing old CodeQL Directory..."
|
|
rm -rf $HOME/codeql
|
|
echo "Done"
|
|
cd "$HOME"
|
|
echo "Downloading CodeQL CLI..."
|
|
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
|
|
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-win64.zip "$LATEST"
|
|
echo "Done"
|
|
echo "Unpacking CodeQL CLI..."
|
|
unzip -q -o codeql-win64.zip
|
|
unzip -q -o codeql-win64.zip codeql/codeql.exe
|
|
rm -f codeql-win64.zip
|
|
echo "Done"
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
shell:
|
|
bash
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Enable problem matchers in repository
|
|
shell: bash
|
|
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
|
|
|
|
- name: Build
|
|
run: |
|
|
$Env:Path += ";$HOME\codeql"
|
|
make
|
|
|
|
- name: Test
|
|
run: |
|
|
$Env:Path += ";$HOME\codeql"
|
|
make test
|