From 231fa83e0eb3f8ac5db568bedfbcc42393e58d33 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 14:48:45 +0100 Subject: [PATCH 1/7] Correct 'script' folder name Per https://github.com/github/scripts-to-rule-them-all the 'script' should be singular. --- {scripts => script}/bootstrap | 0 {scripts => script}/server | 0 {scripts => script}/setup | 0 {scripts => script}/test | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {scripts => script}/bootstrap (100%) rename {scripts => script}/server (100%) rename {scripts => script}/setup (100%) rename {scripts => script}/test (100%) diff --git a/scripts/bootstrap b/script/bootstrap similarity index 100% rename from scripts/bootstrap rename to script/bootstrap diff --git a/scripts/server b/script/server similarity index 100% rename from scripts/server rename to script/server diff --git a/scripts/setup b/script/setup similarity index 100% rename from scripts/setup rename to script/setup diff --git a/scripts/test b/script/test similarity index 100% rename from scripts/test rename to script/test From 4bd69bf2b9182d616c671047a0d5941887a82cd3 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 14:50:33 +0100 Subject: [PATCH 2/7] Correct script path in GH actions --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8d939ad..e6bea46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies run: | - .script/setup + ./script/setup - name: Run lints run: | ./script/test From e34b02d8aafde7a841f064d3b7bca3fbe7d50d38 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 14:52:37 +0100 Subject: [PATCH 3/7] Adjust permissions for scripts We need to make these files executable --- script/bootstrap | 0 script/server | 0 script/setup | 0 script/test | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 script/bootstrap mode change 100644 => 100755 script/server mode change 100644 => 100755 script/setup mode change 100644 => 100755 script/test diff --git a/script/bootstrap b/script/bootstrap old mode 100644 new mode 100755 diff --git a/script/server b/script/server old mode 100644 new mode 100755 diff --git a/script/setup b/script/setup old mode 100644 new mode 100755 diff --git a/script/test b/script/test old mode 100644 new mode 100755 From e9a5e50d0d5987375e17bf5bc366e9ba7bff6b3c Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 15:11:39 +0100 Subject: [PATCH 4/7] Use nvmrc for CI Previously we were using a hardcoded node version but we want to be able to use the version specified in the .nvmrc file. This reduces the maintainence burden of the project and insures the CI always runs against the correct node verison. --- .github/workflows/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6bea46..8ef3d14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,9 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v4 + - name: Read .nvmrc + run: echo "{NODE_VERSION}={$(cat .nvmrc)}" >> $GITHUB_OUTPUT + id: nvm + - name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }} + uses: actions/setup-node@v2 with: - node-version: 22.7.0 + node-version: ${{ steps.nvm.outputs.NODE_VERSION }} - name: Checkout repository uses: actions/checkout@v4 - name: Install dependencies From 5e75cff10f3f0b141444ce48c512cc563e48df91 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 15:55:47 +0100 Subject: [PATCH 5/7] Specify location of nvm For reasons beyond my understanding we can't run `nvm` in this script. So instead we have to specify where it is located. This breaks GH actions but we fix that in the next commit. --- script/bootstrap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/bootstrap b/script/bootstrap index 02d914b..6a1cbb5 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -7,6 +7,10 @@ set -e cd "$(dirname "$0")/.." + +export NVM_DIR=$HOME/.nvm; +source $NVM_DIR/nvm.sh; + echo "==> Installing node version..." nvm install From 08294c9a8d0afe653cc268c6cd9b2c649e0b9c35 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 15:49:27 +0100 Subject: [PATCH 6/7] Specify that scripts should run in bash This is in order for github actions to be able to run 'source' in the bootstrap script but it makes sense to be consistent across scripts. --- script/bootstrap | 2 +- script/server | 2 +- script/setup | 2 +- script/test | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 6a1cbb5..59b35ab 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # script/bootstrap: Resolve all dependencies that the application requires to # run. diff --git a/script/server b/script/server index 7975338..5c1e0e2 100755 --- a/script/server +++ b/script/server @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # script/server: Launch the application diff --git a/script/setup b/script/setup index 76aea9d..6f653f0 100755 --- a/script/setup +++ b/script/setup @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # script/setup: Set up the application for the first time after cloning, or set # it back to the initial unused state. diff --git a/script/test b/script/test index a91a5df..c69b914 100755 --- a/script/test +++ b/script/test @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # script/test: Run the test suite for the application. From eebf16edecb0a9d8f680bd712ddf9849cc24f3c4 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 5 Sep 2024 15:52:24 +0100 Subject: [PATCH 7/7] Correct typo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ef3d14..5497f6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,6 @@ jobs: - name: Install dependencies run: | ./script/setup - - name: Run lints + - name: Run lint run: | ./script/test