From 2e03464a486fa9f5feb31b39d8dd0f58c5673bb2 Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 12:20:51 +0530 Subject: [PATCH 01/11] feat: Added CI --- .github/workflows/ci.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d13d1db --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,32 @@ +name: Continous integration +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + build_and_lint: + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install commitlint + run: | + npm install conventional-changelog-conventionalcommits + npm install commitlint@latest + + - name: Check if builds pass + run: npm run build + + - name: Validate commit messages + if: github.event_name == 'push' + run: npx commitlint --from HEAD~1 --to HEAD --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose From 1140ecb05ab8f0298813fb436a0e07c10b5cb441 Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 12:23:57 +0530 Subject: [PATCH 02/11] fix: Added package.json check for build CI --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d13d1db..d010a86 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,13 @@ jobs: npm install commitlint@latest - name: Check if builds pass - run: npm run build + run: | + if [ -f package.json ]; then + npm run build + else + echo "package.json not found, skipping build step" + fi + shell: bash - name: Validate commit messages if: github.event_name == 'push' From 3579975c9b88a54045e2fa2e0a7dade79e67703e Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 12:25:33 +0530 Subject: [PATCH 03/11] fix: Install dependancies fix --- .github/workflows/ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d010a86..c7325d5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,16 +13,15 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - name: Install dependencies - run: npm ci - name: Install commitlint run: | npm install conventional-changelog-conventionalcommits npm install commitlint@latest - - name: Check if builds pass + - name: Install dependancies and build run: | if [ -f package.json ]; then + npm ci npm run build else echo "package.json not found, skipping build step" From abb771146ed67619bc30d0eea8cca44c3d3866d7 Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 12:29:44 +0530 Subject: [PATCH 04/11] fix: Global dependancy fix --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c7325d5..09a53cb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,8 +15,8 @@ jobs: node-version: 18 - name: Install commitlint run: | - npm install conventional-changelog-conventionalcommits - npm install commitlint@latest + npm install -g conventional-changelog-conventionalcommits + npm install -g commitlint@latest - name: Install dependancies and build run: | From debe622a7e89800cb16ba8da96db4d0618da609a Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 21:17:07 +0530 Subject: [PATCH 05/11] test: testing ci --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 09a53cb..aa4ef0c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: node-version: 18 @@ -30,7 +32,11 @@ jobs: - name: Validate commit messages if: github.event_name == 'push' - run: npx commitlint --from HEAD~1 --to HEAD --verbose + run: | + echo $(git rev-list --count HEAD) + pwd + ls -la + npx commitlint --from HEAD~1 --to HEAD --verbose - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' From 915013fd51606f5f77c37c90474f91609212b313 Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 21:20:50 +0530 Subject: [PATCH 06/11] fix: auto adding commitlint.config.js --- .github/workflows/ci.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aa4ef0c..e91d922 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,9 +33,7 @@ jobs: - name: Validate commit messages if: github.event_name == 'push' run: | - echo $(git rev-list --count HEAD) - pwd - ls -la + echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js npx commitlint --from HEAD~1 --to HEAD --verbose - name: Validate PR commits with commitlint From c499b18860f24149180f5a5076c8462626428abb Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 21:25:09 +0530 Subject: [PATCH 07/11] fix: testing without global dependencies --- .github/workflows/ci.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e91d922..9d8b0ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,18 +17,18 @@ jobs: node-version: 18 - name: Install commitlint run: | - npm install -g conventional-changelog-conventionalcommits - npm install -g commitlint@latest + npm install conventional-changelog-conventionalcommits + npm install commitlint@latest - - name: Install dependancies and build - run: | - if [ -f package.json ]; then - npm ci - npm run build - else - echo "package.json not found, skipping build step" - fi - shell: bash + # - name: Install dependancies and build + # run: | + # if [ -f package.json ]; then + # npm ci + # npm run build + # else + # echo "package.json not found, skipping build step" + # fi + # shell: bash - name: Validate commit messages if: github.event_name == 'push' From 8e3516ba2b0cc8a2086d72a5379c5fc8051d7d0d Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 21:48:18 +0530 Subject: [PATCH 08/11] fix: Fixed commitlint from official issues --- .github/workflows/ci.yaml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9d8b0ed..cfd56a9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,24 +17,22 @@ jobs: node-version: 18 - name: Install commitlint run: | - npm install conventional-changelog-conventionalcommits - npm install commitlint@latest - - # - name: Install dependancies and build - # run: | - # if [ -f package.json ]; then - # npm ci - # npm run build - # else - # echo "package.json not found, skipping build step" - # fi - # shell: bash + sudo npm i -g @commitlint/cli @commitlint/config-conventional + alias commitlint='commitlint --extends "@commitlint/config-conventional"' + + - name: Install dependancies and build + run: | + if [ -f package.json ]; then + npm ci + npm run build + else + echo "package.json not found, skipping build step" + fi + shell: bash - name: Validate commit messages if: github.event_name == 'push' - run: | - echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js - npx commitlint --from HEAD~1 --to HEAD --verbose + run: npx commitlint --from HEAD~1 --to HEAD --verbose - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' From ef9cc8590535dfaf686edc7901df87f349c883d0 Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 21:51:15 +0530 Subject: [PATCH 09/11] fix: added echo --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cfd56a9..c865223 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,7 +32,9 @@ jobs: - name: Validate commit messages if: github.event_name == 'push' - run: npx commitlint --from HEAD~1 --to HEAD --verbose + run: | + echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js + npx commitlint --from HEAD~1 --to HEAD --verbose - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' From 7449f0fe94d9db354d92a8807ac7567771dab97f Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 23:17:47 +0530 Subject: [PATCH 10/11] fix: Fixed commitlint --- .github/workflows/ci.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c865223..f0f1cb7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,8 +17,7 @@ jobs: node-version: 18 - name: Install commitlint run: | - sudo npm i -g @commitlint/cli @commitlint/config-conventional - alias commitlint='commitlint --extends "@commitlint/config-conventional"' + npm i -g @commitlint/config-conventional @commitlint/cli - name: Install dependancies and build run: | @@ -33,9 +32,8 @@ jobs: - name: Validate commit messages if: github.event_name == 'push' run: | - echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js - npx commitlint --from HEAD~1 --to HEAD --verbose + commitlint -x @commitlint/config-conventional --from HEAD~1 --to HEAD --verbose - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' - run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose + run: commitlint -x @commitlint/config-conventional --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose From 994d4aa7a30c4e919efd31801afa2f52d64583ea Mon Sep 17 00:00:00 2001 From: woaitsAryan Date: Sun, 14 Jan 2024 23:21:16 +0530 Subject: [PATCH 11/11] test: testing commitlint --- .github/workflows/ci.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0f1cb7..369db9f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,9 +1,7 @@ name: Continous integration -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] + +on: [push, pull_request] + jobs: build_and_lint: timeout-minutes: 30