Skip to content

Commit

Permalink
Only install dependencies as a part of initialization
Browse files Browse the repository at this point in the history
This ensures that we do not keep any docker containers running for
developers who do not want/use them.

Instead we run dev:reset when starting cms development

This also means that we have to start the CMS for development explicitly
when running tests. We do not use dev:* commands here as they start
running watch processes. Instead we run their subtasks individually.
  • Loading branch information
kasperg committed Dec 5, 2023
1 parent 91fcef8 commit 8b33c3e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Initialize environment
run: "task init ${{ env.TASK_OUTPUT }}"
- name: Prepare CMS for development
run: "task cms:dev ${{ 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
Expand Down
56 changes: 35 additions & 21 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tasks:
- react:clone
- cms:clone
cmds:
- task: reset
- task: install

cleanup:
cmds:
Expand All @@ -29,17 +29,27 @@ tasks:
- task: cleanup
- task: init

reset:
summary: Reset environment. This is useful when switching between tasks, branches etc.
install:
summary: (Re)install all dependencies.
deps:
- design-system:reset
- react:reset
- cms:reset
- design-system:install
- react:install
- cms:install

design-system:clone:
cmds:
- git clone https://github.com/danskernesdigitalebibliotek/dpl-design-system design-system

design-system:install:
dir: design-system
sources:
- package.json
- yarn.lock
generates:
- node_modules/*
cmds:
- yarn install

design-system:link:
deps:
- design-system:build
Expand Down Expand Up @@ -70,18 +80,23 @@ tasks:
cmds:
- yarn dev

design-system:reset:
dir: design-system
cmds:
- yarn install

react:clone:
cmds:
- git clone https://github.com/danskernesdigitalebibliotek/dpl-react react
# Set project name to avoid conflicts with single checkouts.
- cp react/.env.example react/.env
- echo "COMPOSE_PROJECT_NAME={{.REACT_COMPOSE_PROJECT_NAME}}" >> react/.env

react:install:
dir: react
sources:
- package.json
- yarn.lock
generates:
- node_modules/*
cmds:
- yarn install

react:link:
dir: react
deps:
Expand Down Expand Up @@ -116,17 +131,21 @@ tasks:
cmds:
- yarn dev

react:reset:
dir: react
cmds:
- yarn install

cms:clone:
cmds:
- git clone https://github.com/danskernesdigitalebibliotek/dpl-cms cms
# Set project name to avoid conflicts with single checkouts.
- sed "s|COMPOSE_PROJECT_NAME=dpl-cms|COMPOSE_PROJECT_NAME={{.CMS_COMPOSE_PROJECT_NAME}}|g" <cms/.env.example >cms/.env

cms:install:
dir: cms
sources:
- composer.lock
generates:
- vendor/*
cmds:
- task dev:cli -- composer install

cms:link:
dir: cms
deps:
Expand All @@ -142,11 +161,6 @@ tasks:
dir: cms
deps:
- cms:link
cmds:
- task dev:start

cms:reset:
dir: cms
cmds:
- task dev:reset

Expand Down

0 comments on commit 8b33c3e

Please sign in to comment.