Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nationalarchives/tna-frontend into …
Browse files Browse the repository at this point in the history
…feature/hero-cards
  • Loading branch information
ahosgood committed Oct 9, 2023
2 parents bb61234 + dba7b75 commit 560b8c3
Show file tree
Hide file tree
Showing 68 changed files with 1,508 additions and 492 deletions.
18 changes: 18 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on:
workflow_call:

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
shell: bash
- name: Lint
run: npm run lint
shell: bash
92 changes: 92 additions & 0 deletions .github/actions/prototype-kit-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: GOV.UK prototype kit test

on:
workflow_call:

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
shell: bash
- name: Build package
run: >
./tasks/build-package.sh &&
cd package &&
npm pack --pack-destination .
shell: bash
- name: Create prototype
run: >
mkdir prototype &&
cd prototype &&
npx govuk-prototype-kit create
shell: bash
- name: Create usage data config
run: echo "{\"collectUsageData\":false}" > prototype/usage-data-config.json
shell: bash
- name: Install package
run: >
cd prototype &&
npm install ../package/nationalarchives-frontend-$(node -p "require('../package.json').version").tgz
shell: bash
- name: Add imports to template
run: >
echo -e "{% from \"nationalarchives/components/breadcrumbs/macro.njk\" import tnaBreadcrumbs %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/button/macro.njk\" import tnaButton %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/card/macro.njk\" import tnaCard %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/cookie-banner/macro.njk\" import tnaCookieBanner %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/filters/macro.njk\" import tnaFilters %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/footer/macro.njk\" import tnaFooter %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/gallery/macro.njk\" import tnaGallery %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/grid/macro.njk\" import tnaGrid %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/header/macro.njk\" import tnaHeader %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/hero/macro.njk\" import tnaHero %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/index-grid/macro.njk\" import tnaIndexGrid %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/message/macro.njk\" import tnaMessage %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/pagination/macro.njk\" import tnaPagination %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/phase-banner/macro.njk\" import tnaPhaseBanner %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/picture/macro.njk\" import tnaPicture %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/profile/macro.njk\" import tnaProfile %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/sensitive-image/macro.njk\" import tnaSensitiveImage %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/skip-link/macro.njk\" import tnaSkipLink %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/tabs/macro.njk\" import tnaTabs %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html
shell: bash
- name: Add components to template
run: >
echo "\n{% block bodyEnd %}" >> prototype/app/views/index.html &&
echo "{{ tnaBreadcrumbs({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaButton({text:\"I am a button\",url:\"#\"}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaCard({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaCookieBanner({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaFilters({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaFooter({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaGallery({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaGrid({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaHeader({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaHero({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaIndexGrid({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaMessage({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaPagination({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaPhaseBanner({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaPicture({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaProfile({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaSensitiveImage({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaSkipLink({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaTabs({}) }}" >> prototype/app/views/index.html &&
echo "{% endblock %}" >> prototype/app/views/index.html
shell: bash
- name: Run prototype
run: >
cd prototype &&
npm run dev &
shell: bash
- uses: nev7n/wait_for_response@v1
with:
url: "http://localhost:3000"
responseCode: 200
timeout: 30000
interval: 500
21 changes: 21 additions & 0 deletions .github/actions/test-build-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test build package

on:
workflow_call:

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
shell: bash
- name: Build package
run: ./tasks/build-package.sh
shell: bash
- name: Test built package
run: node tasks/test-package.js || exit 1
shell: bash
18 changes: 18 additions & 0 deletions .github/actions/test-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test build Storybook

on:
workflow_call:

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
shell: bash
- name: Build Storybook
run: npm run build
shell: bash
24 changes: 24 additions & 0 deletions .github/actions/tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on:
workflow_call:

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
shell: bash
- name: Build Storybook
run: npm run build
shell: bash
- name: Start Storybook
run: npm start &
shell: bash
- name: Run tests
run: npm run test
shell: bash
18 changes: 0 additions & 18 deletions .github/workflows/_lint.yml

This file was deleted.

86 changes: 0 additions & 86 deletions .github/workflows/_prototype-kit-test.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/_tests.yml

This file was deleted.

48 changes: 39 additions & 9 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,57 @@ jobs:
./tasks/validate-version.sh $VERSION
lint:
runs-on: ubuntu-latest
needs:
- check
uses: ./.github/workflows/_lint.yml

steps:
- uses: actions/checkout@v3
- name: Lint
uses: ./.github/actions/lint

tests:
runs-on: ubuntu-latest
needs:
- lint
uses: ./.github/workflows/_tests.yml
- check
steps:
- uses: actions/checkout@v3
- name: Tests
uses: ./.github/actions/tests

prototype-kit:
test-build:
runs-on: ubuntu-latest
needs:
- check
- lint
- tests
uses: ./.github/workflows/_prototype-kit-test.yml
steps:
- uses: actions/checkout@v3
- name: Test build Storybook
uses: ./.github/actions/test-build

test-build-package:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Test build package
uses: ./.github/actions/test-build-package

prototype-kit:
runs-on: ubuntu-latest
needs:
- test-build-package
steps:
- uses: actions/checkout@v3
- name: GOV.UK prototype kit test
uses: ./.github/actions/prototype-kit-test

publish-npm:
name: Build package and publish to npm
runs-on: ubuntu-latest
needs:
- check
- lint
- tests
- test-build
- prototype-kit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/publish-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ on:
push:
branches:
- main
paths:
- '.storybook/**'
- 'src/**'
- '.babelrc.json'
- '.eslintrc.js'
- '.nvmrc'
- '.stylelintrc'
- 'govuk-prototype-kit.config.json'
- 'package-lock.json'
- 'package.json'
- 'webpack.config.js'

permissions:
contents: read
Expand Down
Loading

0 comments on commit 560b8c3

Please sign in to comment.