Skip to content

Remove references to dapple-support branches #36

Remove references to dapple-support branches

Remove references to dapple-support branches #36

Workflow file for this run

name: Test
on:
push:
env:
# Group output as we make heavy use of parallel and nested tasks.
TASK_OUTPUT: "--output group --output-group-begin '::group::{{.TASK}}' --output-group-end '::endgroup::'"
jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
# TODO replace which with what can be read from .nvmrc if we get a
# separation between checkout and install
node-version: 'lts/*'
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup go-task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Initialize environment
run: "task init ${{ env.TASK_OUTPUT }}"
- name: Link Design system to React components
run: "task react:link ${{ env.TASK_OUTPUT }}"
- name: Link Design system and React components to CMS
run: "task cms:link ${{ env.TASK_OUTPUT }}"
- name: Link Design system to React components (again)
run: "task react:link ${{ env.TASK_OUTPUT }}"
- name: Link Design system and React components to CMS (again)
run: "task cms:link ${{ env.TASK_OUTPUT }}"
- name: Test React components after linking
uses: cypress-io/github-action@v6
with:
start: yarn start:storybook:test
wait-on: "http://localhost:57021"
browser: chrome
working-directory: react
# A single test should be sufficient to ensure that Storybook can
# start, the React components work etc. after linking.
# The demo modal test is simple and quick to execute.
spec: src/apps/demo-modal/demo-modal.test.ts
- name: Test CMS after linking
# A single request to see that the frontpage can be retrieved should be
# sufficient to ensure that Drupal can bootstrap and return a page.
# COMPOSE_PROJECT_NAME must match the value from Dapple Taskfile.yml.
run: "curl --fail http://localhost:$(COMPOSE_PROJECT_NAME=dapple docker compose port varnish 8080 | cut -d: -f2)"
# Test that changes to design system results in changes in React component dependencies
- name: Store current build of Design system in React components
run: |
mkdir ${{ runner.temp }}/design-system
cp node_modules/@danskernesdigitalebibliotek/dpl-design-system/build/css/base.css ${{ runner.temp }}/design-system/base.before.css
working-directory: react
- name: Update design system file
run: |
echo -e "\nh1 { color: pink; }\n" >> src/stories/Library/typography/typography.scss
working-directory: design-system
- name: Build Design system
run: "task design-system:build ${{ env.TASK_OUTPUT }}"
- name: Store new build of Design system in React components
run: |
cp node_modules/@danskernesdigitalebibliotek/dpl-design-system/build/css/base.css ${{ runner.temp }}/design-system/base.after.css
working-directory: react
- name: Ensure there is a difference between design system builds in React components
# We expect a difference and diff will return an error code if there is
# a difference. Reverse this using !.
run: |
! diff ${{ runner.temp }}/design-system/base.before.css ${{ runner.temp }}/design-system/base.after.css
- name: Setup tmate session to support debugging if enabled
if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15