merge main #3420
Workflow file for this run
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: Run macro, script and visual tests | |
on: [push] | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
RUNNING_IN_CI: true | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Read .nvmrc file | |
id: read-nvmrc-file | |
run: echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
- name: Install Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.read-nvmrc-file.outputs.nvmrc }}" | |
- name: Install dependencies | |
run: yarn install | |
- name: Run macro and script tests | |
run: yarn test | |
- name: Create Slack notification | |
if: always() | |
uses: edge/simple-slack-notify@master | |
with: | |
channel: '#pat-lib-notifications' | |
status: ${{ job.status }} | |
success_text: 'Macro and script tests completed successfully' | |
failure_text: 'Macro and script tests failed' | |
cancelled_text: 'Macro and script tests was cancelled' | |
fields: | | |
[{ "title": "Action", "value": "${env.GITHUB_WORKFLOW} - build (${env.GITHUB_RUN_NUMBER})", "short": true }, | |
{ "title": "Repository", "value": "${env.GITHUB_REPOSITORY}", "short": true }, | |
{ "title": "By", "value": "${{ github.actor }}", "short": true }, | |
{ "title": "Branch", "value": "${{ github.head_ref }}", "short": true }, | |
{ "title": "View job", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}] | |
run-visual-regression-tests: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
url: https://github.com/ONSdigital/design-system.git | |
- name: Install Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Install dependencies | |
run: yarn install | |
- name: Install Docker | |
run: | | |
brew install docker | |
colima start | |
- name: Run visual regression tests | |
run: yarn test-visual | |
- name: Create Slack notification | |
if: always() | |
uses: edge/simple-slack-notify@master | |
with: | |
channel: '#pat-lib-notifications' | |
status: ${{ job.status }} | |
success_text: 'Visual regression tests completed successfully' | |
failure_text: 'Visual regression tests failed' | |
cancelled_text: 'Visual regression tests was cancelled' | |
fields: | | |
[{ "title": "Action", "value": "${env.GITHUB_WORKFLOW} - build (${env.GITHUB_RUN_NUMBER})", "short": true }, | |
{ "title": "Repository", "value": "${env.GITHUB_REPOSITORY}", "short": true }, | |
{ "title": "By", "value": "${{ github.actor }}", "short": true }, | |
{ "title": "Branch", "value": "${{ github.head_ref }}", "short": true }, | |
{ "title": "View job", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}] | |