mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 09:10:07 +08:00
118 lines
3.5 KiB
YAML
118 lines
3.5 KiB
YAML
# Checks logs, SARIF, and database bundle debug artifacts exist.
|
|
name: PR Check - Debug artifact upload
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- releases/v1
|
|
- releases/v2
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
workflow_dispatch: {}
|
|
jobs:
|
|
upload-artifacts:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-20.04
|
|
version: stable-20211005
|
|
- os: macos-latest
|
|
version: stable-20211005
|
|
- os: ubuntu-20.04
|
|
version: stable-20220120
|
|
- os: macos-latest
|
|
version: stable-20220120
|
|
- os: ubuntu-latest
|
|
version: stable-20220401
|
|
- os: macos-latest
|
|
version: stable-20220401
|
|
- os: ubuntu-latest
|
|
version: cached
|
|
- os: macos-latest
|
|
version: cached
|
|
- os: ubuntu-latest
|
|
version: latest
|
|
- os: macos-latest
|
|
version: latest
|
|
- os: ubuntu-latest
|
|
version: nightly-latest
|
|
- os: macos-latest
|
|
version: nightly-latest
|
|
name: Upload debug artifacts
|
|
env:
|
|
CODEQL_ACTION_TEST_MODE: true
|
|
timeout-minutes: 45
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v3
|
|
- name: Prepare test
|
|
id: prepare-test
|
|
uses: ./.github/prepare-test
|
|
with:
|
|
version: ${{ matrix.version }}
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ^1.13.1
|
|
- uses: ./../action/init
|
|
with:
|
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
|
debug: true
|
|
debug-artifact-name: my-debug-artifacts
|
|
debug-database-name: my-db
|
|
- name: Build code
|
|
shell: bash
|
|
run: ./build.sh
|
|
- uses: ./../action/analyze
|
|
id: analysis
|
|
download-and-check-artifacts:
|
|
name: Download and check debug artifacts
|
|
needs: upload-artifacts
|
|
timeout-minutes: 45
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v3
|
|
- name: Check expected artifacts exist
|
|
shell: bash
|
|
run: |
|
|
VERSIONS="stable-20211005 stable-20220120 stable-20220401 cached latest nightly-latest"
|
|
LANGUAGES="cpp csharp go java javascript python"
|
|
for version in $VERSIONS; do
|
|
if [[ "$version" =~ stable-(20211005|20220120|20210809) ]]; then
|
|
# Note the absence of the period in "ubuntu-2004": this is present in the image name
|
|
# but not the artifact name
|
|
OPERATING_SYSTEMS="ubuntu-2004 macos-latest"
|
|
else
|
|
OPERATING_SYSTEMS="ubuntu-latest macos-latest"
|
|
fi
|
|
for os in $OPERATING_SYSTEMS; do
|
|
pushd "./my-debug-artifacts-$os-$version"
|
|
echo "Artifacts from version $version on $os:"
|
|
for language in $LANGUAGES; do
|
|
echo "- Checking $language"
|
|
if [[ ! -f "$language.sarif" ]] ; then
|
|
echo "Missing a SARIF file for $language"
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "my-db-$language.zip" ]] ; then
|
|
echo "Missing a database bundle for $language"
|
|
exit 1
|
|
fi
|
|
if [[ ! -d "$language/log" ]] ; then
|
|
echo "Missing logs for $language"
|
|
exit 1
|
|
fi
|
|
done
|
|
popd
|
|
done
|
|
done
|
|
env:
|
|
GO111MODULE: auto
|