From 2f234d7387129c884ed14f3ca7f810a9190f7dd9 Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:19:22 +0100 Subject: [PATCH 01/13] 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..aa53f86 --- /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: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x, 22.x, 24.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 install + - run: npm test From 6573ea3a2791898322620b8193c6fe1c93ec7724 Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:27:57 +0100 Subject: [PATCH 02/13] Update Node CI workflow --- .github/workflows/node.js.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index aa53f86..051d971 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,13 +5,12 @@ name: Node.js CI on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: - runs-on: ubuntu-latest strategy: @@ -20,11 +19,19 @@ jobs: # 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 install - - run: npm test + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - run: pnpm install + - run: pnpm ci:lint + - run: pnpm ci:format + - run: pnpm ci:coverage + - run: pnpm test From 3cb8003ca9b68d1c00addea6bd7ff519a1e8caf8 Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:28:09 +0100 Subject: [PATCH 03/13] Update --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 051d971..282ea1e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.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: Node.js CI +name: Node CI on: push: From 1b0415a9a2165d4bee7af2dfcecc66c2c95208f4 Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:32:06 +0100 Subject: [PATCH 04/13] Update --- .prettierignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index dc3d677..0239445 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,3 @@ -.github .nyc_output node_modules coverage From f49f479d1deb60efa9ffe445ba6dbff92723a95c Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:33:24 +0100 Subject: [PATCH 05/13] Update --- .github/workflows/node.js.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 282ea1e..b753913 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -23,8 +23,6 @@ jobs: uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 - with: - version: 10 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: From af9ed70196fead902bc3001a5041708daf732b3f Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:34:44 +0100 Subject: [PATCH 06/13] Update engine mismatch --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index b753913..8c7dff9 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - node-version: [20.x, 22.x, 24.x] + node-version: [22.x, 24.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: From e3962c4919e1cf254d6022099ea56cded99a61af Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 16:36:10 +0100 Subject: [PATCH 07/13] Move test before coverage check --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 8c7dff9..c500a73 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -31,5 +31,5 @@ jobs: - run: pnpm install - run: pnpm ci:lint - run: pnpm ci:format - - run: pnpm ci:coverage - run: pnpm test + - run: pnpm ci:coverage From 871fada1cd355e7fd779cf00bd4b2b298ef2b6b5 Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:03:47 +0100 Subject: [PATCH 08/13] Add workflow to publish test coverage to GitHub pages --- .github/workflows/static.yml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..340f762 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,47 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy test coverage to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + - run: pnpm install + - run: pnpm test + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './coverage' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 749aa5c22c8127df8a1dd486940d49284cea23bc Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:10:46 +0100 Subject: [PATCH 09/13] Update static and Node CI --- .github/workflows/node.js.yml | 4 ++++ .github/workflows/static.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c500a73..e31e03c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -6,8 +6,12 @@ name: Node CI on: push: branches: ["main"] + paths: + - src/**/* pull_request: branches: ["main"] + paths: + - src/**/* jobs: build: diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 340f762..ca282d8 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -41,7 +41,7 @@ jobs: uses: actions/upload-pages-artifact@v3 with: # Upload entire repository - path: './coverage' + path: "./coverage" - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 From 2ed5b840cfd42b07b3ca3401f7ebc739d9c4b51b Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:15:34 +0100 Subject: [PATCH 10/13] Update --- .github/workflows/node.js.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index e31e03c..1299f34 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,17 +1,11 @@ # 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 CI +name: Node PR checks on: - push: - branches: ["main"] - paths: - - src/**/* pull_request: branches: ["main"] - paths: - - src/**/* jobs: build: From 83426a5a9f2467bda7db427dd8fdce3419b6f77a Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:18:50 +0100 Subject: [PATCH 11/13] Update --- .github/workflows/node.js.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1299f34..b27ee9d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -6,6 +6,8 @@ name: Node PR checks on: pull_request: branches: ["main"] + paths: + - src/**/* jobs: build: From f10a397cc270cf20033a4d43ffd41bb93eef732b Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:24:08 +0100 Subject: [PATCH 12/13] Update --- src/algorithms/matrices.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/matrices.ts b/src/algorithms/matrices.ts index 9c0ba67..c2053ee 100644 --- a/src/algorithms/matrices.ts +++ b/src/algorithms/matrices.ts @@ -5,6 +5,7 @@ export function sum(matrix: number[][]): number { let sum = 0; + console.log(matrix); for (let i = 0; i < matrix.length; i += 1) { for (let j = 0; j < matrix[i].length; j += 1) { From 6fbccd0217d2917b93c78cca5bb4776b55e527de Mon Sep 17 00:00:00 2001 From: Simone Spaccarotella Date: Fri, 18 Jul 2025 17:27:00 +0100 Subject: [PATCH 13/13] Update --- package.json | 5 ++++- pnpm-lock.yaml | 4 ++++ src/algorithms/matrices.ts | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 774564f..6b38fcf 100644 --- a/package.json +++ b/package.json @@ -68,5 +68,8 @@ "bugs": { "url": "https://github.com/simonespa/algorithms-and-data-structures/issues" }, - "homepage": "https://github.com/simonespa/algorithms-and-data-structures#readme" + "homepage": "https://github.com/simonespa/algorithms-and-data-structures#readme", + "dependencies": { + "algorithms-and-data-structures": "link:" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 10825ff..3a19c33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,10 @@ settings: importers: .: + dependencies: + algorithms-and-data-structures: + specifier: 'link:' + version: 'link:' devDependencies: '@eslint/js': specifier: ^9.31.0 diff --git a/src/algorithms/matrices.ts b/src/algorithms/matrices.ts index c2053ee..9c0ba67 100644 --- a/src/algorithms/matrices.ts +++ b/src/algorithms/matrices.ts @@ -5,7 +5,6 @@ export function sum(matrix: number[][]): number { let sum = 0; - console.log(matrix); for (let i = 0; i < matrix.length; i += 1) { for (let j = 0; j < matrix[i].length; j += 1) {