Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ado-gha-axe-core): remove check run, add workflow enforcer, add fail-on-accessibility-error #1219

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -37,6 +37,7 @@ jobs:
static-site-dir: ${{ github.workspace }}/dev/website-root

- name: Upload report artifact
if: success() || failure()
uses: actions/[email protected]
with:
name: accessibility-reports
Expand Down
6 changes: 3 additions & 3 deletions packages/ado-extension/src/ioc/setup-ioc-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { iocTypes, setupSharedIocContainer } from '@accessibility-insights-actio
import { ADOTaskConfig } from '../task-config/ado-task-config';
import { AdoIocTypes } from './ado-ioc-types';
import { ADOArtifactsInfoProvider } from '../ado-artifacts-info-provider';
import { WorkflowEnforcer } from '../progress-reporter/enforcement/workflow-enforcer';
import { AdoWorkflowEnforcer } from '../progress-reporter/enforcement/ado-workflow-enforcer';
import { AdoConsoleCommentCreator } from '../progress-reporter/console/ado-console-comment-creator';
import { TelemetryClientFactory } from '../telemetry/telemetry-client-factory';
import { TelemetrySender } from '../progress-reporter/telemetry/telemetry-sender';
Expand All @@ -21,15 +21,15 @@ export function setupIocContainer(container = new inversify.Container({ autoBind
container.bind(AdoIocTypes.AppInsights).toConstantValue(AppInsights);
container.bind(iocTypes.TaskConfig).to(ADOTaskConfig).inSingletonScope();
container.bind(AdoConsoleCommentCreator).toSelf().inSingletonScope();
container.bind(WorkflowEnforcer).toSelf().inSingletonScope();
container.bind(AdoWorkflowEnforcer).toSelf().inSingletonScope();
container.bind(TelemetrySender).toSelf().inSingletonScope();
container
.bind(iocTypes.ProgressReporters)
.toDynamicValue((context) => {
return [
context.container.get(AdoConsoleCommentCreator),
context.container.get(TelemetrySender),
context.container.get(WorkflowEnforcer),
context.container.get(AdoWorkflowEnforcer),
];
})
.inSingletonScope();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`WorkflowEnforcer completeRun with baseline and failOnAccessibilityError=false fails with pinned error log if baseline needs to be updated 1`] = `
exports[`AdoWorkflowEnforcer completeRun with baseline and failOnAccessibilityError=false fails with pinned error log if baseline needs to be updated 1`] = `
Array [
"[info] ##vso[task.logissue type=error;sourcepath=/some/file] The baseline file does not match scan results.",
]
`;

exports[`WorkflowEnforcer completeRun with baseline and failOnAccessibilityError=true fails with pinned error log if baseline needs to be updated 1`] = `
exports[`AdoWorkflowEnforcer completeRun with baseline and failOnAccessibilityError=true fails with pinned error log if baseline needs to be updated 1`] = `
Array [
"[info] ##vso[task.logissue type=error;sourcepath=/some/file] The baseline file does not match scan results.",
]
`;

exports[`WorkflowEnforcer completeRun without baseline fails with pinned error log if accessibility error occurs and failOnAccessibilityError=true 1`] = `
exports[`AdoWorkflowEnforcer completeRun without baseline fails with pinned error log if accessibility error occurs and failOnAccessibilityError=true 1`] = `
Array [
"[error] Accessibility error(s) were found",
"[info] To prevent accessibility errors from failing your build, you can:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { ADOTaskConfig } from '../../task-config/ado-task-config';
import { CombinedReportParameters } from 'accessibility-insights-report';

import { BaselineEvaluation, BaselineFileContent } from 'accessibility-insights-scan';
import { WorkflowEnforcer } from './workflow-enforcer';
import { AdoWorkflowEnforcer } from './ado-workflow-enforcer';
import { RecordingTestLogger } from '@accessibility-insights-action/shared';

describe(WorkflowEnforcer, () => {
describe(AdoWorkflowEnforcer, () => {
let adoTaskConfigMock: IMock<ADOTaskConfig>;
let logger: RecordingTestLogger;
let testSubject: WorkflowEnforcer;
let testSubject: AdoWorkflowEnforcer;

const reportWithErrors = {
results: {
Expand All @@ -40,7 +40,7 @@ describe(WorkflowEnforcer, () => {
beforeEach(() => {
adoTaskConfigMock = Mock.ofType<ADOTaskConfig>(undefined, MockBehavior.Strict);
logger = new RecordingTestLogger();
testSubject = new WorkflowEnforcer(adoTaskConfigMock.object, logger);
testSubject = new AdoWorkflowEnforcer(adoTaskConfigMock.object, logger);
});

describe('completeRun', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CombinedReportParameters } from 'accessibility-insights-report';
import { BaselineEvaluation } from 'accessibility-insights-scan';

@injectable()
export class WorkflowEnforcer extends ProgressReporter {
export class AdoWorkflowEnforcer extends ProgressReporter {
private scanSucceeded = true;

constructor(
Expand Down
5 changes: 5 additions & 0 deletions packages/gh-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ inputs:
description: 'To get deterministic scanning results, either specify the singleWorker parameter or ensure that the value specified for the maxUrls parameter is larger than the total number of urls in the web site being scanned.'
required: true
default: true
fail-on-accessibility-error:
description: 'Fail the build if there are accessibility issues.'
required: true
default: true
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -88,3 +92,4 @@ runs:
INPUT_INPUT-URLS: ${{ inputs.input-urls }}
INPUT_STATIC-SITE-PORT: ${{ inputs.static-site-port }}
INPUT_SCAN-TIMEOUT: ${{ inputs.scan-timeout }}
INPUT_FAIL-ON-ACCESSIBILITY-ERROR: ${{ inputs.fail-on-accessibility-error }}
203 changes: 0 additions & 203 deletions packages/gh-action/src/check-run/check-run-creator.spec.ts

This file was deleted.

Loading