Updated path #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '[Documentation] Accessibility Check' | |
# Adapted from https://docusaurus.io/docs/deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- chanel-8217-accessibility-checks | |
# paths: | |
# - VAMobile/src/components/** | |
# - VAMobile/documentation/** | |
# - VAMobile/src/utils/hooks.tsx | |
jobs: | |
test-deploy: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Step 1: Clean npm cache | |
- name: Clean npm cache | |
run: npm cache clean --force | |
# Step 2: Install Axe CLI globally | |
- name: Install Axe CLI globally | |
run: npm install -g @axe-core/cli@latest | |
# Step 3: Update npm | |
- name: Update npm | |
run: npm install -g npm@latest | |
# Step 4: Setup Node.js environment | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'VAMobile/.nvmrc' | |
cache: yarn | |
cache-dependency-path: VAMobile/yarn.lock | |
# Step 5: Install dependencies and build | |
- name: Test build | |
working-directory: VAMobile | |
run: | | |
yarn install --frozen-lockfile | |
cd documentation | |
yarn install --frozen-lockfile | |
yarn build | |
# Step 6: Start web server | |
- name: Start web server | |
working-directory: VAMobile/documentation | |
run: npm start & npx wait-on http://localhost:3000 & | |
# Step 7: Extract URLs from sitemap | |
- name: Extract URLs from sitemap | |
id: extract-urls | |
run: | | |
wget https://department-of-veterans-affairs.github.io/va-mobile-app/sitemap.xml -O sitemap.xml | |
cat sitemap.xml | grep "<loc>" | sed 's/.*<loc>\(.*\)<\/loc>.*/\1/' > VAMobile/documentation/urls.txt | |
# - name: Run accessibility check | |
# run: | | |
# while IFS= read -r url; do | |
# npx axe-cli "$url" --no-color --tags wcag2a,wcag2aa --report "$url-axe-report.json" | |
# done < urls.txt | |
# Add any additional logic here based on the output of the accessibility check | |
### | |
# Step 8: Run accessibility check | |
- name: Run accessibility check | |
working-directory: VAMobile/documentation # Set the working directory to the repository's root directory | |
run: | | |
# Ensure that the URLs file exists | |
if [ ! -f "urls.txt" ]; then | |
echo "Error: urls.txt file not found." | |
exit 1 | |
fi | |
while IFS= read -r url; do | |
# Use a unique name for the report file based on the URL | |
report_file="${url//\//-}-axe-report.json" | |
axe "$url" --exit --tags wcag2a,wcag2aa > "$report_file" | |
done < urls.txt | |
# - name: Run documentation site | |
# working-directory: VAMobile/documentation | |
# run: yarn start | |
# - name: Setup docs | |
# working-directory: VAMobile/documentation | |
# run: cd VAMobile && yarn docs | |
#- name: Wait for server to start | |
# working-directory: VAMobile/documentation | |
# run: npx wait-on http://localhost:3000 | |
# - name: Run axe | |
# working-directory: VAMobile/documentation | |
# run: | | |
# npm install -g @axe-core/cli | |
# axe http://localhost:3000 --exit | |
# start_slack_thread: | |
# name: Start Slack thread | |
# needs: test-deploy | |
#uses: ./.github/workflows/start_slack_thread.yml | |
# secrets: inherit | |
# with: | |
# channel_name: va-mobile-build-alerts | |
# # message: 'On demand build started by {{ github.actor }}: \"{{ inputs.notes }}\" (:git: `{{ github.ref_name }}`). This process may take a while. See :thread: or <{{ github.server_url }}/{{ github.repository }}/actions/runs/{{ github.run_id }}|workflow run> for results.' | |