Skip to content

Add CodeQL analysis workflow configuration#1716

Open
awakeairplane wants to merge 1 commit intoaustindyoung:mainfrom
awakeairplane:patch-2
Open

Add CodeQL analysis workflow configuration#1716
awakeairplane wants to merge 1 commit intoaustindyoung:mainfrom
awakeairplane:patch-2

Conversation

@awakeairplane
Copy link
Copy Markdown

https://github.com/user/repo.git[
{
"body": "",
"closingIssuesReferences": [],
"number": 616,
"title": "Fix hardcoded playlist name in URL import to use filename extraction",
"url": "4gray/iptvnator#616"
},
...
]on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact run: | zip --junk-paths my-artifact README.md - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} draft: false prerelease: false - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a upload_url. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps asset_path: ./my-artifact.zip asset_name: my-artifact.zip asset_content_type: application/zipSkip to content vscode-driftfence-mirror-fork
Repository navigation
Code
Pull requests
1.7k
(1.7k)
Agents
vscode-driftfence-mirror-fork/src/vs/workbench/contrib/testing/browser /testingProgressUiService.ts
connor4312
connor4312
9 months ago
85 lines (71 loc) · 3.09 KB

Code

Blame
/*---------------------------------------------------------------------------------------------

  • Copyright (c) Microsoft Corporation. All rights reserved.
  • Licensed under the MIT License. See License.txt in the project root for license information. --------------------------------------------------------------------------------------------/

import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js'; import { autorun } from '../../../../base/common/observable.js'; import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js'; import { IViewsService } from '../../../services/views/common/viewsService.js'; import { AutoOpenTesting, getTestingConfiguration, TestingConfigKeys } from '../common/configuration.js'; import { Testing } from '../common/constants.js';
import { ITestCoverageService } from '../common/testCoverageService.js'; import { isFailedState } from '../common/testingStates.js'; import { LiveTestResult, TestResultItemChangeReason } from '../common/testResult.js'; import { ITestResultService } from '../common/testResultService.js'; import { ExplorerTestCoverageBars } from './testCoverageBars.js';

/** Workbench contribution that triggers updates in the TestingProgressUi service */ export class TestingProgressTrigger extends Disposable {
public static readonly ID = 'workbench.contrib.testing.progressTrigger';

constructor(
	@ITestResultService resultService: ITestResultService,
	@ITestCoverageService testCoverageService: ITestCoverageService,
	@IConfigurationService private readonly configurationService: IConfigurationService,
	@IViewsService private readonly viewsService: IViewsService,
) {
	super();

	this._register(resultService.onResultsChanged((e) => {
		if ('started' in e) {
			this.attachAutoOpenForNewResults(e.started);
		}
	}));

	const barContributionRegistration = autorun(reader => {
		const hasCoverage = !!testCoverageService.selected.read(reader);
		if (!hasCoverage) {
			return;
		}

		barContributionRegistration.dispose();
		ExplorerTestCoverageBars.register();
	});

	this._register(barContributionRegistration);
}

private attachAutoOpenForNewResults(result: LiveTestResult) {
	if (result.request.preserveFocus === true) {
		return;
	}

	const cfg = getTestingConfiguration(this.configurationService, TestingConfigKeys.OpenResults);
	if (cfg === AutoOpenTesting.NeverOpen) {
		return;
	}

	if (cfg === AutoOpenTesting.OpenExplorerOnTestStart) {
		return this.openExplorerView();
	}

	if (cfg === AutoOpenTesting.OpenOnTestStart) {
		return this.openResultsView();
	}

	// open on failure
	const disposable = new DisposableStore();
	disposable.add(result.onComplete(() => disposable.dispose()));
	disposable.add(result.onChange(e => {
		if (e.reason === TestResultItemChangeReason.OwnStateChange && isFailedState(e.item.ownComputedState)) {
			this.openResultsView();
			disposable.dispose();
		}
	}));
}

private openExplorerView() {
	this.viewsService.openView(Testing.ExplorerViewId, false);
}

private openResultsView() {
	this.viewsService.openView(Testing.ResultsViewId, false);
}

}

https://github.com/user/repo.git[
    {
        "body": "<Truncated>",
        "closingIssuesReferences": [],
        "number": 616,
        "title": "Fix hardcoded playlist name in URL import to use filename extraction",
        "url": "4gray/iptvnator#616"
    },
...
]on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
    - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
  build:
    name: Upload Release Asset
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Build project # This would actually build your project, using zip for an example artifact
        run: |
          zip --junk-paths my-artifact README.md
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false
      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
          asset_path: ./my-artifact.zip
          asset_name: my-artifact.zip
          asset_content_type: application/zipSkip to content
vscode-driftfence-mirror-fork
Repository navigation
Code
Pull requests
1.7k
 (1.7k)
Agents
vscode-driftfence-mirror-fork/src/vs/workbench/contrib/testing/browser
/testingProgressUiService.ts
connor4312
connor4312
9 months ago
85 lines (71 loc) · 3.09 KB

Code

Blame
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
import { autorun } from '../../../../base/common/observable.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { IViewsService } from '../../../services/views/common/viewsService.js';
import { AutoOpenTesting, getTestingConfiguration, TestingConfigKeys } from '../common/configuration.js';
import { Testing } from '../common/constants.js';
import { ITestCoverageService } from '../common/testCoverageService.js';
import { isFailedState } from '../common/testingStates.js';
import { LiveTestResult, TestResultItemChangeReason } from '../common/testResult.js';
import { ITestResultService } from '../common/testResultService.js';
import { ExplorerTestCoverageBars } from './testCoverageBars.js';

/** Workbench contribution that triggers updates in the TestingProgressUi service */
export class TestingProgressTrigger extends Disposable {
	public static readonly ID = 'workbench.contrib.testing.progressTrigger';

	constructor(
		@ITestResultService resultService: ITestResultService,
		@ITestCoverageService testCoverageService: ITestCoverageService,
		@IConfigurationService private readonly configurationService: IConfigurationService,
		@IViewsService private readonly viewsService: IViewsService,
	) {
		super();

		this._register(resultService.onResultsChanged((e) => {
			if ('started' in e) {
				this.attachAutoOpenForNewResults(e.started);
			}
		}));

		const barContributionRegistration = autorun(reader => {
			const hasCoverage = !!testCoverageService.selected.read(reader);
			if (!hasCoverage) {
				return;
			}

			barContributionRegistration.dispose();
			ExplorerTestCoverageBars.register();
		});

		this._register(barContributionRegistration);
	}

	private attachAutoOpenForNewResults(result: LiveTestResult) {
		if (result.request.preserveFocus === true) {
			return;
		}

		const cfg = getTestingConfiguration(this.configurationService, TestingConfigKeys.OpenResults);
		if (cfg === AutoOpenTesting.NeverOpen) {
			return;
		}

		if (cfg === AutoOpenTesting.OpenExplorerOnTestStart) {
			return this.openExplorerView();
		}

		if (cfg === AutoOpenTesting.OpenOnTestStart) {
			return this.openResultsView();
		}

		// open on failure
		const disposable = new DisposableStore();
		disposable.add(result.onComplete(() => disposable.dispose()));
		disposable.add(result.onChange(e => {
			if (e.reason === TestResultItemChangeReason.OwnStateChange && isFailedState(e.item.ownComputedState)) {
				this.openResultsView();
				disposable.dispose();
			}
		}));
	}

	private openExplorerView() {
		this.viewsService.openView(Testing.ExplorerViewId, false);
	}

	private openResultsView() {
		this.viewsService.openView(Testing.ResultsViewId, false);
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant