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

repo sync #526

Merged
merged 3 commits into from
Oct 14, 2020
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
1 change: 1 addition & 0 deletions .github/allowed-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = [
'crowdin/[email protected]',
'dawidd6/action-delete-branch@v3',
'docker://chinthakagodawita/autoupdate-action:v1',
'fkirc/skip-duplicate-actions@a12175f6209d4805b5a163d723270be2a0dc7b36',
'github/codeql-action/analyze@v1',
'github/codeql-action/init@v1',
'ianwalter/[email protected]',
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
name: Browser Tests

on: [push]
on:
workflow_dispatch:
push:

jobs:
see_if_should_skip:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@a12175f6209d4805b5a163d723270be2a0dc7b36
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '["assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ubuntu-latest
steps:
- name: Checkout
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Checkout
uses: actions/checkout@v2
- name: Install

- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Install
uses: ianwalter/[email protected]
with:
args: npm ci
- name: Test

- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Test
uses: ianwalter/[email protected]
with:
args: npm run browser-test
args: npm run browser-test
5 changes: 4 additions & 1 deletion .github/workflows/pa11y.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Pa11y"
on: [push]
on:
workflow_dispatch:
schedule:
- cron: "25 17 * * *" # once a day at 17:25 UTC / 11:50 PST
jobs:
test:
runs-on: ubuntu-latest
Expand Down
64 changes: 48 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name: Node.js Tests

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -14,79 +15,110 @@ env:
CI: true

jobs:
see_if_should_skip:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@a12175f6209d4805b5a163d723270be2a0dc7b36
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths_ignore: '[".all-contributorsrc", ".env.example", ".gitattributes", ".vscode/**", "app.json", "assets/**", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "contributing/**", "crowdin-actions-config.yml", "crowdin.yml", "docs", "javascripts/**", "jest-puppeteer.config.js", "LICENSE-CODE", "LICENSE", "nodemon.json", "ownership.yaml", "README.md", "script/**", "stylesheets/**"]'
lint:
needs: see_if_should_skip
runs-on: ubuntu-latest
steps:
- name: Check out repo
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Check out repo
uses: actions/checkout@v2

- name: Setup node
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Get npm cache directory
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node modules
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Install dependencies
run: npm ci

- name: Run linter
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Run linter
run: npx standard

- name: Check dependencies
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Check dependencies
run: npm run check-deps

test:
needs: see_if_should_skip
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-group: [content, meta, rendering, routing, unit, links-and-images]
steps:
- name: Check out repo
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Check out repo
uses: actions/checkout@v2

- name: Setup node
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Get npm cache directory
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node modules
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Install dependencies
run: npm ci

- name: Run build script
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Run build script
run: npm run build

- name: Run tests
- if: ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
name: Run tests
run: npx jest tests/${{ matrix.test-group }}/

- name: Send Slack notification if workflow fails
uses: rtCamp/action-slack-notify@master
if: failure() && github.ref == 'early-access'
env:
SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }}
SLACK_MESSAGE: "Tests are failing on the `early-access` branch. https://github.com/github/docs-internal/tree/early-access"
SLACK_MESSAGE: "Tests are failing on the `early-access` branch. https://github.com/github/docs-internal/tree/early-access"