Giter Club home page Giter Club logo

github-actions's Introduction

github-action

Tests

A feature rich GitHub action that runs actionable accessibility reports on your website that can handle large workloads.

Some of the primary features include pass/fail testing, code fixes, and detailed reports.

When running locally the action uses A11yWatch Lite and installs the a11ywatch-cli.

Usage

- uses: a11ywatch/[email protected]
  with:
    WEBSITE_URL: ${{ secrets.WEBSITE_URL }}
    SITE_WIDE: true
    SUBDOMAINS: true
    TLD: false
    SITEMAP: true
    FAIL_ERRORS_COUNT: 15
    LIST: true
    FIX: false
    UPGRADE: false
    UPLOAD: true
    COMPUTER_VISION_SUBSCRIPTION_KEY: ${{ secrets.COMPUTER_VISION_SUBSCRIPTION_KEY }}
    COMPUTER_VISION_ENDPOINT: ${{ secrets.COMPUTER_VISION_ENDPOINT }}
  env:
    DEFAULT_RUNNERS: htmlcs,axe
    PAGEMIND_IGNORE_WARNINGS: true
    AI_DISABLED: false

Action inputs

All inputs are optional except $WEBSITE_URL.

Name Description Default
WEBSITE_URL Website domain to scan (Start with http:// or https://).
SITE_WIDE Site-wide scanning across all pages. false
FIX Attempt to apply recommendations to code and commit to github. false
SUBDOMAINS Include all subdomains (required SITE_WIDE=true). true
SITEMAP Extend crawl with sitemap links (required SITE_WIDE=true). true
TLD Include all tld extensions (required SITE_WIDE=true). true
LIST Report the results to github as a pass or fail list or detailed report. false
RECORD Record the audit as video to a directory.
FAIL_TOTAL_COUNT Determine whether to fail the CI if total issues warnings and errors exceed the counter. Takes precedence over the other FAIL inputs. Set to a value greater than 0 for CI failure. 0
FAIL_ERRORS_COUNT Determine whether to fail the CI if total issues with errors exceed the counter. Set to a value greater than 0 for CI failure. 0
FAIL_WARNINGS_COUNT Determine whether to fail the CI if total issues with warnings exceed the counter. Set to a value greater than 0 for CI failure. 0
EXTERNAL Use the A11yWatch remote API for fast results. If this is set A11YWATCH_TOKEN is needed.
COMPUTER_VISION_SUBSCRIPTION_KEY Computer Vision API key for image recognition on alts.
COMPUTER_VISION_ENDPOINT Computer Vision url endpoint. false
DISABLE_PR_STATS Prevent messaging to the pr results of test. false
TOKEN GITHUB_TOKEN (permissions contents: write and pull-requests: write) or a repo scoped Personal Access Token (PAT). GITHUB_TOKEN
A11YWATCH_TOKEN The A11yWatch API token to use to identify a user.
SLIM Use the gRPC client to gather reports - only displays stats, useful for large websites (no code generation, no outputs, just pure stats) false
UPGRADE Upgrade the docker images before testing to latest. false
UPLOAD Upload the data as an artifact to get better insight. false

Action Outputs

Name Description Default
issues The amount of issues found.
results The results of the audit as json.

ENV Variables

Configure crawl wide settings for A11yWatch Lite (local) installs.

Name Description Default
DEFAULT_RUNNERS A comma separated list of runners to use in Litemode for testing like axe and htmlcs. htmlcs,axe
PAGEMIND_IGNORE_WARNINGS Enable to ignore all warnings from output. This could speed up runs and save on audit size. false
AI_DISABLED Disable AI use to get missing resource props like alts. If enabled the speed may increase of the run. false

If you set it to only htmlcs you will have really fast crawls with good coverage with our fork.

Performance

On a larger website A11yWatch action runs over 60x-10,000x+ faster depending on CPUs/hardware. After the first installation you should have faster setup time between runs. You can expect to handle at least 1k pages per minute on a 2-core CPU 7 GB of RAM memory shared github action. If you enable RECORD the output time may increase a bit.

Common Issues

If you experience issues on your CI you may have to toggle the UPGRADE input to true in order to get the latest installs. If you see a playwright error try adding PLAYWRIGHT_VERSION env variable with the newest version to install chrome.

LICENSE

check the license file in the root of the project.

github-actions's People

Contributors

arbourd avatar j-mendez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

github-actions's Issues

Trying with Jekyll localhost and I am only seeing 2 pages being crawled

Follow-up from CivicActions/accessibility#687 (comment)

Here is my .github workflow in the PR CivicActions/accessibility#697:

name: a11ywatch

on: [pull_request]

jobs:
  build:
    name: Building site and running a11ywatch
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source.
        uses: actions/checkout@v2

      - name: Install jekyll site dependencies.
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.6
          bundler-cache: true

      - name: Install npm dependencies.
        run: npm ci

      - name: Start up jekyll server.
        run: bundle exec jekyll serve --detach -c _config.yml,_config_local.yml

      - uses: a11ywatch/[email protected]
        with:
          WEBSITE_URL: http://localhost:4000
          SITE_WIDE: true
          SITEMAP: true
          LIST: true

I fixed the sitemap issue mentioned in the other thread. When the action runs it only crawls 2 pages. Here is the output from https://github.com/CivicActions/accessibility/actions/runs/5050879141/jobs/9062115155?pr=697

Run a11ywatch crawl --url http://localhost:4000   --sitemap --save 
  
{"code":0,"data":[{"domain":"localhost","issues":[],"issuesInfo":{"accessScore":0,"errorCount":0,"issueMeta":{"skipContentIncluded":true},"noticeCount":0,"totalIssues":0,"warningCount":0},"lastScanDate":"2023-05-22T22:14:29.108Z","online":true,"pageLoadTime":{"duration":0,"durationFormated":"Cached/Extremely Fast"},"url":"http://localhost:4000"},{"domain":"localhost","issues":[],"issuesInfo":{"accessScore":0,"errorCount":0,"issueMeta":{"skipContentIncluded":true},"noticeCount":0,"totalIssues":0,"warningCount":0},"lastScanDate":"2023-05-22T22:14:29.122Z","online":true,"pageLoadTime":{"duration":0,"durationFormated":"Cached/Extremely Fast"},"url":"http://localhost:4000"}],"message":"Crawled 2 pages in 360.327889ms","success":true}

Is the port the issue? Is there another configuration option I should try?

Fix connecting to chrome from puppeteer in CI [Local]

We have issues with gathering issues in the CI when using the local docker action since the container pagemind cannot make request to the docker chrome instance. You can curl the connections in the container steps but, not between the containers. This is blocking the action from being used locally.

Scan with fix gives "error: unexpected argument '--vers 13.0.0' found"

I'm trying to run the GHA with this yaml:

web-accessibility-eval:
    needs: dev-deploy
    runs-on: ubuntu-latest

    steps:
      - name: Web Accessibility Eval
        uses: a11ywatch/[email protected]
        with:
          WEBSITE_URL: "https://mywebsite.com/dev/"
          SITE_WIDE: false
          SUBDOMAINS: false
          TLD: false
          SITEMAP: false
          FAIL_ERRORS_COUNT: 15
          LIST: true
          FIX: true
          UPGRADE: true
          UPLOAD: true
        env:
          DEFAULT_RUNNERS: htmlcs,axe
          PAGEMIND_IGNORE_WARNINGS: true
          AI_DISABLED: false

It gets to the point of running the scan command a11ywatch scan --url https://mywebsite.com/dev/ --save --fix and then seems to fail installing dependencies for fix:

Installing required rust ripgrep for code fix...
error: unexpected argument '--vers 13.0.0' found

  tip: a similar argument exists: '--vers'

Usage: cargo install --version <VERSION> [crate]...

For more information, try '--help'.
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/a11ywatch_cli-0.10.13/src/fs/code_fix.rs:27:10:
Failed to execute ripgrep replace: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Process completed with exit code 101.

It works without fix enabled.

Authentication required message

I am attempting to use this action on a site that has no authentication, but am receiving this error;

Run a11ywatch scan --url https://azure.github.io/AKS-Construction/ --external --save
{"data":null,"message":"Authentication required. Add your authentication header and try again.","success":false}

To reproduce

name: Accessibility
on:
  workflow_dispatch:

jobs:
  accessibility:
    runs-on: ubuntu-latest
    steps:
      #- uses: actions/checkout@v3

      - uses: a11ywatch/[email protected]
        name: Accessibility checks
        with:
          WEBSITE_URL: https://azure.github.io/AKS-Construction/
          FAIL_ERROR_COUNT: 10
          EXTERNAL: false

URL_LIST feature suggestion

Hi again, sorry for the back to back issues. This one's more of a feature request. I'm trying to run this action on a dev site as part of a CI/CD pipeline. The dev site is an AWS API Gateway (running flask) and has a URL like https://abcde12345.execute-api.us-east-1.amazonaws.com/dev/. Whenever I try to run it with SITE_WIDE enabled, it runs until I cancel it (I've let it go for an hour plus vs when it's not enabled and it runs in ~5 mins with installation). And it always seems to hang on the a11ywatch crawl step.

So my question/feature request is this: would it be possible to add a URL_LIST kind of parameter that lets you run a11ywatch scan on each specified page instead of using a11ywatch crawl? Or, even better, am I just using the action wrong and there's a good way to handle this already? I tried adding a sitemap.xml using flask-sitemapper (which works) but the action still runs for way longer than it should to scan just the few pages of my site (again, never seen it finish). Is there a better way to strictly limit the crawl to pages off the root URL?

web-accessibility-eval:
    needs: dev-deploy
    runs-on: ubuntu-latest

    steps:
      - name: Web Accessibility Eval
        uses: a11ywatch/[email protected]
        with:
          WEBSITE_URL: "https://abcde12345.execute-api.us-east-1.amazonaws.com/dev/"
          SITE_WIDE: false
          SUBDOMAINS: false
          TLD: false
          SITEMAP: true
          FAIL_ERRORS_COUNT: 15
          LIST: true
          FIX: true
          UPGRADE: false
          UPLOAD: true
        env:
          DEFAULT_RUNNERS: htmlcs,axe
          PAGEMIND_IGNORE_WARNINGS: true
          AI_DISABLED: false

Thanks in advance for any help :)

Insert code fixes onto PRS - workflows

Automatic adjustments to code. Heres a list of some features that can be really useful.

  1. add alts from the ai if probability score is hit above threshold at all locations.
    • detect how the image was created so it can add the property accordingly.
      -- if dynamic from CMS look into integrating plugin workflows
  2. fix color adjustments.
  3. auto add skip content button based on theme.

[Feature]: Allow returning only errors

Having a lot of warnings takes up a lot of space and sometimes only errors are of importance for the project.

External users can configure website settings with A11yWatch.com by the end of the week with more advanced customizations like excluding warnings etc.

This feature would help the action aspect and something that would not take that much effort to integrate.

Fix site-wide local action usage.

Currently the local usage of the site-wide option seems to take a very long time. Need to investigate if theres any issues or if the duration is due to some other issue.

On my local machine scanning https://a11ywatch.com across the full 22 public pages takes around 5 seconds on a 2gb docker setup mac m1. When performing single page scans on the action the results occur quickly so not sure if the magnitude difference between a 5 min action to a 30 min action should arise ( It should take a max of 6 mins or so based on the prev action durations to setup and run the scans ).

CI Not Failing

Run a11ywatch/github-actions@v2 with: WEBSITE_URL: http://localhost:9000 SUBDOMAINS: false TLD: false FAIL_ERRORS_COUNT: 0 LIST: true UPGRADE: true FIX: false EXTERNAL: false SITE_WIDE: false SITEMAP: false RECORD: false FAIL_TOTAL_COUNT: 0 FAIL_WARNINGS_COUNT: 0 DISABLE_PR_STATS: false SLIM: true

The above comes from the logs after I run my action. The actions log contain:

{"accessScore":90,"errorCount":4,"issueMeta":{"missingAltCount":null,"skipContentIncluded":true},"noticeCount":0,"totalIssues":13,"warningCount":9},"lastScanDate":"2023-09-29T10:55:11.582Z","online":true,"pageLoadTime":{"duration":245,"durationFormated":"Lightning Fast"},"url":"http://localhost:9000"},"message":"Scan completed in 1.25735276s","success":true}

Which shows that there are axe errors in the application but the job still passes and doesn't fail

Docker executor for local scans.

Currently we can start up a local docker instance with the A11yWatch suite on the CI but, we cannot perform network request to the local machine at the port due to CI restrictions. The CI pipelines for A11yWatch at the moment require the EXTERNAL flag to be used. In order to allow local builds we need to create a docker image that can run docker exec inside the docker container to gather all the issues.

In the mean time set the A11YWATCH_API key from the website under a free account while we bring this feature into play. You can also start up the A11yWatch suite on a small dedicated 2-4gb instance to use for your own server instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.