|
| 1 | +# Checks logs, SARIF, and database bundle debug artifacts exist and are accessible |
| 2 | +# with download-artifact@v4 when CODEQL_ACTION_ARTIFACT_UPGRADE is set to true. |
| 3 | +name: PR Check - Debug artifact upload using artifact@v2 |
| 4 | +env: |
| 5 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 6 | + CODEQL_ACTION_ARTIFACT_UPGRADE: true |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - releases/v* |
| 12 | + pull_request: |
| 13 | + types: |
| 14 | + - opened |
| 15 | + - synchronize |
| 16 | + - reopened |
| 17 | + - ready_for_review |
| 18 | + schedule: |
| 19 | + - cron: '0 5 * * *' |
| 20 | + workflow_dispatch: {} |
| 21 | +jobs: |
| 22 | + upload-artifacts: |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + version: |
| 27 | + - stable-v2.13.5 |
| 28 | + - stable-v2.14.6 |
| 29 | + - stable-v2.15.5 |
| 30 | + - stable-v2.16.6 |
| 31 | + - stable-v2.17.6 |
| 32 | + - default |
| 33 | + - linked |
| 34 | + - nightly-latest |
| 35 | + name: Upload debug artifacts |
| 36 | + env: |
| 37 | + CODEQL_ACTION_TEST_MODE: true |
| 38 | + timeout-minutes: 45 |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Check out repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + - name: Prepare test |
| 44 | + id: prepare-test |
| 45 | + uses: ./.github/actions/prepare-test |
| 46 | + with: |
| 47 | + version: ${{ matrix.version }} |
| 48 | + - uses: actions/setup-go@v5 |
| 49 | + with: |
| 50 | + go-version: ^1.13.1 |
| 51 | + - uses: ./../action/init |
| 52 | + id: init |
| 53 | + with: |
| 54 | + tools: ${{ steps.prepare-test.outputs.tools-url }} |
| 55 | + debug: true |
| 56 | + debug-artifact-name: my-debug-artifacts |
| 57 | + debug-database-name: my-db |
| 58 | + # We manually exclude Swift from the languages list here, as it is not supported on Ubuntu |
| 59 | + languages: cpp,csharp,go,java,javascript,python,ruby |
| 60 | + - name: Build code |
| 61 | + shell: bash |
| 62 | + run: ./build.sh |
| 63 | + - uses: ./../action/analyze |
| 64 | + id: analysis |
| 65 | + download-and-check-artifacts: |
| 66 | + name: Download and check debug artifacts |
| 67 | + needs: upload-artifacts |
| 68 | + timeout-minutes: 45 |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - name: Download all artifacts |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + - name: Check expected artifacts exist |
| 74 | + shell: bash |
| 75 | + run: | |
| 76 | + VERSIONS="stable-v2.13.5 stable-v2.14.6 stable-v2.15.5 stable-v2.16.6 stable-v2.17.6 default linked nightly-latest" |
| 77 | + LANGUAGES="cpp csharp go java javascript python" |
| 78 | + for version in $VERSIONS; do |
| 79 | + pushd "./my-debug-artifacts-${version//./}" |
| 80 | + echo "Artifacts from version $version:" |
| 81 | + for language in $LANGUAGES; do |
| 82 | + echo "- Checking $language" |
| 83 | + if [[ ! -f "$language.sarif" ]] ; then |
| 84 | + echo "Missing a SARIF file for $language" |
| 85 | + exit 1 |
| 86 | + fi |
| 87 | + if [[ ! -f "my-db-$language.zip" ]] ; then |
| 88 | + echo "Missing a database bundle for $language" |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | + if [[ ! -d "$language/log" ]] ; then |
| 92 | + echo "Missing logs for $language" |
| 93 | + exit 1 |
| 94 | + fi |
| 95 | + done |
| 96 | + popd |
| 97 | + done |
| 98 | + env: |
| 99 | + GO111MODULE: auto |
0 commit comments