Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'main' into daverlo/python-mac
David Verdeguer authored and GitHub committed Oct 22, 2020

Unverified

No user is associated with the committer email.
2 parents bf20a55 + badb286 commit e23b3ef
Showing 7 changed files with 93 additions and 7 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release-runner.yml
@@ -0,0 +1,54 @@
name: Release runner

on:
workflow_dispatch:
inputs:
bundle-tag:
description: 'Tag of the bundle release (e.g., "codeql-bundle-20200826")'
required: false

jobs:
release-runner:
runs-on: ubuntu-latest
env:
RELEASE_TAG: "${{ github.event.inputs.bundle-tag }}"

strategy:
matrix:
extension: ["linux", "macos", "win.exe"]

steps:
- uses: actions/checkout@v2

- name: Build runner
run: |
cd runner
npm install
npm run build-runner
- uses: actions/upload-artifact@v2
with:
name: codeql-runner-${{matrix.extension}}
path: runner/dist/codeql-runner-${{matrix.extension}}

- name: Resolve Upload URL for the release
if: ${{ github.event.inputs.bundle-tag != null }}
id: save_url
run: |
UPLOAD_URL=$(curl -sS \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq .upload_url | sed s/\"//g)
echo ${UPLOAD_URL}
echo "::set-output name=upload_url::${UPLOAD_URL}"
- name: Upload Platform Package
if: ${{ github.event.inputs.bundle-tag != null }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.save_url.outputs.upload_url }}
asset_path: runner/dist/codeql-runner-${{matrix.extension}}
asset_name: codeql-runner-${{matrix.extension}}
asset_content_type: application/octet-stream
3 changes: 3 additions & 0 deletions lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/analyze-action.ts
@@ -1,7 +1,11 @@
import * as core from "@actions/core";

import * as actionsUtil from "./actions-util";
import { AnalysisStatusReport, runAnalyze } from "./analyze";
import {
AnalysisStatusReport,
runAnalyze,
CodeQLAnalysisError,
} from "./analyze";
import { getConfig } from "./config-utils";
import { getActionsLogger } from "./logging";
import { parseRepositoryNwo } from "./repository";
@@ -84,6 +88,11 @@ async function run() {
} catch (error) {
core.setFailed(error.message);
console.log(error);

if (error instanceof CodeQLAnalysisError) {
stats = { ...error.queriesStatusReport };
}

await sendStatusReport(startedAt, stats, error);
return;
}
17 changes: 15 additions & 2 deletions src/analyze.ts
@@ -13,6 +13,17 @@ import * as sharedEnv from "./shared-environment";
import * as upload_lib from "./upload-lib";
import * as util from "./util";

export class CodeQLAnalysisError extends Error {
queriesStatusReport: QueriesStatusReport;

constructor(queriesStatusReport: QueriesStatusReport, message: string) {
super(message);

this.name = "CodeQLAnalysisError";
this.queriesStatusReport = queriesStatusReport;
}
}

export interface QueriesStatusReport {
// Time taken in ms to analyze builtin queries for cpp (or undefined if this language was not analyzed)
analyze_builtin_queries_cpp_duration_ms?: number;
@@ -190,10 +201,12 @@ export async function runQueries(
}
}
} catch (e) {
logger.error(`Error running analysis for ${language}: ${e}`);
logger.info(e);
statusReport.analyze_failure_language = language;
return statusReport;
throw new CodeQLAnalysisError(
statusReport,
`Error running analysis for ${language}: ${e}`
);
}
}

0 comments on commit e23b3ef

Please sign in to comment.