From 38613af0f53f5a05eee9b0d3f859de0151f6f9a0 Mon Sep 17 00:00:00 2001 From: Samuel Hoile Date: Tue, 15 Oct 2024 10:19:26 +0100 Subject: [PATCH 01/11] Create node.js.yml --- .github/workflows/node.js.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..56d11f6 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "add_git_workflows" ] + pull_request: + branches: [ "add_git_workflows" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run build --if-present + - run: npm run test From 3d002c1c765a276b03c781216a59bd2fbecb544d Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 10:28:15 +0100 Subject: [PATCH 02/11] added test --- frontend/tests/test.test.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 frontend/tests/test.test.js diff --git a/frontend/tests/test.test.js b/frontend/tests/test.test.js new file mode 100644 index 0000000..00fe4cf --- /dev/null +++ b/frontend/tests/test.test.js @@ -0,0 +1,7 @@ +import { describe, expect, test } from "vitest"; + +describe('mock test for CI', () => { + test('mock test 1', () => { + expect(true).toBe(true) + }) +}) \ No newline at end of file From b1b97818b5af4c291a51e194608d00cf1ae866a7 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 10:34:07 +0100 Subject: [PATCH 03/11] added default run working-directory --- .github/workflows/frontend.js.yml | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/frontend.js.yml diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml new file mode 100644 index 0000000..05faaef --- /dev/null +++ b/.github/workflows/frontend.js.yml @@ -0,0 +1,32 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Frontend CI + +on: + push: + branches: [ "add_git_workflows" ] + pull_request: + branches: [ "add_git_workflows" ] + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run build --if-present + - run: npm run test From 948ea42370fd2ba6c3d2c7876e807ecdb768a09e Mon Sep 17 00:00:00 2001 From: Samuel Hoile Date: Tue, 15 Oct 2024 10:35:27 +0100 Subject: [PATCH 04/11] Delete .github/workflows/node.js.yml --- .github/workflows/node.js.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 56d11f6..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [ "add_git_workflows" ] - pull_request: - branches: [ "add_git_workflows" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm run build --if-present - - run: npm run test From 7e7c56af92bdbe01ab8b0687d07941521c50f3cb Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 11:12:58 +0100 Subject: [PATCH 05/11] add install command --- .github/workflows/frontend.js.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index 05faaef..ee7b580 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -16,17 +16,17 @@ jobs: run: working-directory: frontend - strategy: - matrix: - node-version: [18.x, 20.x, 22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 22.x uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 22.x cache: 'npm' - - run: npm run build --if-present - - run: npm run test + - name: Install dependencies + run: npm install + - name: Build + run: npm run build --if-present + - name: Test + run: npm run test From 24604fe3c0adcb97ea75d13ab74be51f7ea21153 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 11:20:24 +0100 Subject: [PATCH 06/11] added api workflow --- .github/workflows/api.js.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/api.js.yml diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml new file mode 100644 index 0000000..ee7b580 --- /dev/null +++ b/.github/workflows/api.js.yml @@ -0,0 +1,32 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Frontend CI + +on: + push: + branches: [ "add_git_workflows" ] + pull_request: + branches: [ "add_git_workflows" ] + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'npm' + - name: Install dependencies + run: npm install + - name: Build + run: npm run build --if-present + - name: Test + run: npm run test From cb1ee4d4d6130e247c8b6feb210e2b7fb0ee2b48 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 11:23:55 +0100 Subject: [PATCH 07/11] renamed actions --- .github/workflows/api.js.yml | 10 +++++----- .github/workflows/frontend.js.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml index ee7b580..e1e169c 100644 --- a/.github/workflows/api.js.yml +++ b/.github/workflows/api.js.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Frontend CI +name: API CI on: push: @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest defaults: run: - working-directory: frontend + working-directory: api steps: @@ -24,9 +24,9 @@ jobs: with: node-version: 22.x cache: 'npm' - - name: Install dependencies + - name: API - Install dependencies run: npm install - - name: Build + - name: API - Build run: npm run build --if-present - - name: Test + - name: API - Tests run: npm run test diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index ee7b580..7bdcd4b 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -24,9 +24,9 @@ jobs: with: node-version: 22.x cache: 'npm' - - name: Install dependencies + - name: Frontend - install dependencies run: npm install - - name: Build + - name: Frontend - Build run: npm run build --if-present - - name: Test + - name: Frontend - Tests run: npm run test From 83eccc87b18ef211a5a4dfd3f3da9c30cf452058 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 11:30:53 +0100 Subject: [PATCH 08/11] changed workflow branch to main --- .github/workflows/api.js.yml | 4 ++-- .github/workflows/frontend.js.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml index e1e169c..4e7437c 100644 --- a/.github/workflows/api.js.yml +++ b/.github/workflows/api.js.yml @@ -5,9 +5,9 @@ name: API CI on: push: - branches: [ "add_git_workflows" ] + branches: [ "main" ] pull_request: - branches: [ "add_git_workflows" ] + branches: [ "main" ] jobs: build: diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index 7bdcd4b..5985c64 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -5,9 +5,9 @@ name: Frontend CI on: push: - branches: [ "add_git_workflows" ] + branches: [ "main" ] pull_request: - branches: [ "add_git_workflows" ] + branches: [ "main" ] jobs: build: From 31ea107a851a3f0070420f7bb5c159b8a49c6328 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 12:00:40 +0100 Subject: [PATCH 09/11] updated to run on all branches --- .github/workflows/api.js.yml | 19 ++++++++++++----- .github/workflows/frontend.js.yml | 35 +++++++++++++++++++------------ 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml index 4e7437c..62f18c6 100644 --- a/.github/workflows/api.js.yml +++ b/.github/workflows/api.js.yml @@ -5,9 +5,11 @@ name: API CI on: push: - branches: [ "main" ] + branches: + - '*' pull_request: - branches: [ "main" ] + branches: + - '*' jobs: build: @@ -24,9 +26,16 @@ jobs: with: node-version: 22.x cache: 'npm' - - name: API - Install dependencies + - name: API - install dependencies run: npm install - - name: API - Build + - name: API - build run: npm run build --if-present - - name: API - Tests + + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: api + steps: + - name: API - run tests run: npm run test diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index 5985c64..d63bbaa 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -5,9 +5,11 @@ name: Frontend CI on: push: - branches: [ "main" ] + branches: + -'*' pull_request: - branches: [ "main" ] + branches: + - '*' jobs: build: @@ -18,15 +20,22 @@ jobs: steps: - - uses: actions/checkout@v4 - - name: Use Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - cache: 'npm' - - name: Frontend - install dependencies - run: npm install - - name: Frontend - Build - run: npm run build --if-present - - name: Frontend - Tests + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'npm' + - name: API - install dependencies + run: npm install + - name: API - build + run: npm run build --if-present + + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: fontend + steps: + - name: API - run tests run: npm run test From e089b07709abfd72470c10d4c92f293e84b58df6 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 12:06:26 +0100 Subject: [PATCH 10/11] fixed test stage... --- .github/workflows/api.js.yml | 9 ++++++++- .github/workflows/frontend.js.yml | 15 +++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml index 62f18c6..d3d065b 100644 --- a/.github/workflows/api.js.yml +++ b/.github/workflows/api.js.yml @@ -33,9 +33,16 @@ jobs: test: runs-on: ubuntu-latest + needs: build defaults: run: working-directory: api - steps: + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'npm' - name: API - run tests run: npm run test diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index d63bbaa..c54f4d1 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -26,16 +26,23 @@ jobs: with: node-version: 22.x cache: 'npm' - - name: API - install dependencies + - name: Frontend - install dependencies run: npm install - - name: API - build + - name: Frontend - build run: npm run build --if-present test: runs-on: ubuntu-latest + needs: build defaults: run: working-directory: fontend - steps: - - name: API - run tests + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'npm' + - name: Frontend - run tests run: npm run test From eea328473e8d13992fdaf49769b4e9d1409dd09b Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Tue, 15 Oct 2024 12:17:06 +0100 Subject: [PATCH 11/11] reverted back to before.... --- .github/workflows/api.js.yml | 16 ++-------------- .github/workflows/frontend.js.yml | 18 ++---------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/.github/workflows/api.js.yml b/.github/workflows/api.js.yml index d3d065b..24624cd 100644 --- a/.github/workflows/api.js.yml +++ b/.github/workflows/api.js.yml @@ -30,19 +30,7 @@ jobs: run: npm install - name: API - build run: npm run build --if-present - - test: - runs-on: ubuntu-latest - needs: build - defaults: - run: - working-directory: api - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - cache: 'npm' - name: API - run tests run: npm run test + + diff --git a/.github/workflows/frontend.js.yml b/.github/workflows/frontend.js.yml index c54f4d1..1172953 100644 --- a/.github/workflows/frontend.js.yml +++ b/.github/workflows/frontend.js.yml @@ -30,19 +30,5 @@ jobs: run: npm install - name: Frontend - build run: npm run build --if-present - - test: - runs-on: ubuntu-latest - needs: build - defaults: - run: - working-directory: fontend - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - cache: 'npm' - - name: Frontend - run tests - run: npm run test + - name: Frontend - run tests + run: npm run test