From 5b9a1e47a18640cf2fdf2eb92b721c0c65cf7e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Tue, 5 Dec 2023 18:02:56 +0100 Subject: [PATCH 1/2] Add support for resetting an environment This will reset the state of an environment. This is useful when switching between tasks, branches etc. Add usage of this to the test. --- .github/workflows/test.yml | 2 ++ Taskfile.yml | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6d4137..e87c036 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,6 +72,8 @@ jobs: # a difference. Reverse this using !. run: | ! diff ${{ runner.temp }}/design-system/base.before.css ${{ runner.temp }}/design-system/base.after.css + - name: Reset environment + run: "task reset ${{ env.TASK_OUTPUT }}" - name: Setup tmate session to support debugging if enabled if: runner.debug == '1' uses: mxschmitt/action-tmate@v3 diff --git a/Taskfile.yml b/Taskfile.yml index ae46576..e9983f7 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -26,6 +26,13 @@ tasks: - task: cleanup - task: init + reset: + summary: Reset environment. This is useful when switching between tasks, branches etc. + deps: + - design-system:reset + - react:reset + - cms:reset + design-system:init: sources: - design-system/yarn.lock @@ -65,6 +72,11 @@ tasks: cmds: - yarn dev + design-system:reset: + dir: design-system + cmds: + - yarn install + react:init: sources: - react/yarn.lock @@ -103,6 +115,11 @@ tasks: cmds: - yarn dev + react:reset: + dir: react + cmds: + - yarn install + cms:init: sources: - cms/composer.lock @@ -130,6 +147,11 @@ tasks: cmds: - task dev:start + cms:reset: + dir: cms + cmds: + - task dev:reset + dev:react: deps: - design-system:build From 090fe30ed45f59b93156ab6491a6b9c87a618164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Tue, 5 Dec 2023 18:15:40 +0100 Subject: [PATCH 2/2] Split cloning repos and initing projects into sepatate tasks Init'ing is actually just a matter of cloning and resetting so this should simplify things a bit. --- Taskfile.yml | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index e9983f7..1ce6494 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -10,9 +10,11 @@ tasks: init: summary: Setup this directory for development deps: - - design-system:init - - react:init - - cms:init + - design-system:clone + - react:clone + - cms:clone + cmds: + - task: reset cleanup: cmds: @@ -33,14 +35,9 @@ tasks: - react:reset - cms:reset - design-system:init: - sources: - - design-system/yarn.lock - generates: - - design-system/node_modules/* + design-system:clone: cmds: - git clone https://github.com/danskernesdigitalebibliotek/dpl-design-system design-system - - (cd design-system && yarn install) design-system:link: deps: @@ -77,14 +74,9 @@ tasks: cmds: - yarn install - react:init: - sources: - - react/yarn.lock - generates: - - react/node_modules/* + react:clone: cmds: - git clone https://github.com/danskernesdigitalebibliotek/dpl-react react - - (cd react && yarn install) react:link: dir: react @@ -120,14 +112,9 @@ tasks: cmds: - yarn install - cms:init: - sources: - - cms/composer.lock - generates: - - cms/vendor/* + cms:clone: cmds: - git clone https://github.com/danskernesdigitalebibliotek/dpl-cms cms - - (cd cms && task dev:reset) cms:link: dir: cms