From cbffecad4b44ee6a8ae0d3ef7602d39ed6684415 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 18:11:42 -0800 Subject: [PATCH 01/12] added a script to intall packages depending on OS --- .github/workflows/ci.yml | 4 ++-- .github/workflows/docs.yml | 2 +- package.json | 1 + scripts/install_packages.sh | 23 +++++++++++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 scripts/install_packages.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 250c21f..9c46749 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [12.x] - platform: [ubuntu-latest] #[ubuntu-latest, windows-latest, macos-latest] + platform: [ubuntu-latest, windows-latest, macos-latest] # Build OS runs-on: ${{ matrix.platform }} # CI @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} # install packages - name: Install Packages - run: npm i + run: npm run install # create a config file - name: Create Config File uses: "finnp/create-file-action@master" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8a16f7a..fbcca98 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: node-version: ${{ matrix.node-version }} # install packages - name: Install Packages - run: npm i + run: npm run install # build doc - name: Build docs run: npm run docs diff --git a/package.json b/package.json index ced7db4..69f73ce 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "", "main": "index.js", "scripts": { + "install": "./scripts/install_packages.sh", "dev": "prettier --write app/* --tab-width 4 && nodemon app/index.js", "dep": "pm2 start app/index.js", "docs": "./node_modules/.bin/docma -c docma.json && prettier --write app/* --tab-width 4", diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh new file mode 100755 index 0000000..f65e427 --- /dev/null +++ b/scripts/install_packages.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +case "$(uname -s)" in + + Darwin) + echo 'Mac OS X' && npm i + ;; + + Linux) + echo 'Linux' && npm i + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + echo 'MS Windows' && npm i && npm i windows-build-tools && npm i ffmpeg-static + ;; + + # Add here more strings to compare + # See correspondence table at the bottom of this answer + + *) + echo 'Other OS' + ;; +esac \ No newline at end of file From 3da75bd96bd9816643a31dbad4092b954568d1ad Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 18:25:01 -0800 Subject: [PATCH 02/12] packages weren't installed, updating execution command --- package.json | 2 +- scripts/install_packages.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 69f73ce..7758765 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "install": "./scripts/install_packages.sh", + "install": "bash scripts/install_packages.sh", "dev": "prettier --write app/* --tab-width 4 && nodemon app/index.js", "dep": "pm2 start app/index.js", "docs": "./node_modules/.bin/docma -c docma.json && prettier --write app/* --tab-width 4", diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh index f65e427..b72304a 100755 --- a/scripts/install_packages.sh +++ b/scripts/install_packages.sh @@ -1,5 +1,3 @@ -#!/bin/sh - case "$(uname -s)" in Darwin) From 4bbc04b1de7af4e6488777190bfd657e7b1161dc Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 18:54:48 -0800 Subject: [PATCH 03/12] removing custom installation script and change write-file-action --- .github/workflows/ci.yml | 9 +++++---- .github/workflows/docs.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c46749..7e076af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,13 +22,14 @@ jobs: node-version: ${{ matrix.node-version }} # install packages - name: Install Packages - run: npm run install + run: npm i # create a config file - name: Create Config File - uses: "finnp/create-file-action@master" + uses: "DamianReeves/write-file-action@v1.0" env: - FILE_NAME: "config.json" - FILE_DATA: '{"BITLY_TOKEN": "${{ secrets.BITLY_TOKEN }}","TWITCH_TOKEN": "${{ secrets.TWITCH_TOKEN }}","DISCORD_TOKEN": "${{ secrets.DISCORD_TOKEN }}"}' + path: "./config.json" + contents: '{"BITLY_TOKEN": "${{ secrets.BITLY_TOKEN }}","TWITCH_TOKEN": "${{ secrets.TWITCH_TOKEN }}","DISCORD_TOKEN": "${{ secrets.DISCORD_TOKEN }}"}' + write-mode: overwrite # run tests - name: Run tests run: npm run test:ci diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fbcca98..8a16f7a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: node-version: ${{ matrix.node-version }} # install packages - name: Install Packages - run: npm run install + run: npm i # build doc - name: Build docs run: npm run docs From 5e1d4699122651d038799e97839da4c8afec0759 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 18:56:48 -0800 Subject: [PATCH 04/12] update npm install command --- package.json | 1 - scripts/install_packages.sh | 21 --------------------- 2 files changed, 22 deletions(-) delete mode 100755 scripts/install_packages.sh diff --git a/package.json b/package.json index 7758765..ced7db4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "", "main": "index.js", "scripts": { - "install": "bash scripts/install_packages.sh", "dev": "prettier --write app/* --tab-width 4 && nodemon app/index.js", "dep": "pm2 start app/index.js", "docs": "./node_modules/.bin/docma -c docma.json && prettier --write app/* --tab-width 4", diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh deleted file mode 100755 index b72304a..0000000 --- a/scripts/install_packages.sh +++ /dev/null @@ -1,21 +0,0 @@ -case "$(uname -s)" in - - Darwin) - echo 'Mac OS X' && npm i - ;; - - Linux) - echo 'Linux' && npm i - ;; - - CYGWIN*|MINGW32*|MSYS*|MINGW*) - echo 'MS Windows' && npm i && npm i windows-build-tools && npm i ffmpeg-static - ;; - - # Add here more strings to compare - # See correspondence table at the bottom of this answer - - *) - echo 'Other OS' - ;; -esac \ No newline at end of file From 9c77ae477d969963ea15565d56ed5fc5457b0db1 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:01:02 -0800 Subject: [PATCH 05/12] update write-file-action settings --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e076af..f348779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,8 @@ jobs: # create a config file - name: Create Config File uses: "DamianReeves/write-file-action@v1.0" - env: - path: "./config.json" + with: + path: ./config.json contents: '{"BITLY_TOKEN": "${{ secrets.BITLY_TOKEN }}","TWITCH_TOKEN": "${{ secrets.TWITCH_TOKEN }}","DISCORD_TOKEN": "${{ secrets.DISCORD_TOKEN }}"}' write-mode: overwrite # run tests From f4d17ffec9b872daf4ca5c681e9975e942d2694e Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:07:37 -0800 Subject: [PATCH 06/12] update package.json to include updated fsevents --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index ced7db4..6fa8ca8 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ }, "author": "", "license": "ISC", + "resolutions": { + "**/**/fsevents": "^1.2.9" + }, "dependencies": { "@discordjs/opus": "^0.3.3", "axios": ">=0.21.1", From 5612a8a0409af1a54785fa96ff23357fb9bbb4f4 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:30:31 -0800 Subject: [PATCH 07/12] update ci post request when testing for windows failure --- .github/workflows/ci.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f348779..ed61f81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,16 +37,22 @@ jobs: - name: Tests ✅ if: ${{ success() }} run: | - curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ - "context": "tests", - "state": "success", - "description": "Tests passed", - "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - }' + curl \ + -X POST \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ + -d '{ + "context": "tests", + "state": "success", + "description": "Tests passed", + "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }' - name: Tests 🚨 if: ${{ failure() }} run: | - curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ + curl \ + -X POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ "context": "tests", "state": "failure", "description": "Tests failed", From e0e6be54aa688939ca01aa7d4dc84365b9ffa231 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:35:25 -0800 Subject: [PATCH 08/12] update ci post request --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed61f81..697633b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,14 +40,14 @@ jobs: curl \ -X POST \ -H 'Accept: application/vnd.github.v3+json' \ - -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ - -d '{ + -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --data '{ "context": "tests", "state": "success", "description": "Tests passed", "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' + https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} - name: Tests 🚨 if: ${{ failure() }} run: | From 0586dec3dc95beddccbfea1c46ade16ccf72e990 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:39:10 -0800 Subject: [PATCH 09/12] update ci post request with newline character --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 697633b..921d795 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,12 +41,12 @@ jobs: -X POST \ -H 'Accept: application/vnd.github.v3+json' \ -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --data '{ - "context": "tests", - "state": "success", - "description": "Tests passed", - "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - }' + --data '{ \ + "context": "tests", \ + "state": "success", \ + "description": "Tests passed", \ + "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + }' \ https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} - name: Tests 🚨 if: ${{ failure() }} From 65e3f03ffed5a5bf6ef4b51291c926caaf4d4308 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:39:26 -0800 Subject: [PATCH 10/12] update ci post request with newline character --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 921d795..12a66cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,11 @@ jobs: -X POST \ -H 'Accept: application/vnd.github.v3+json' \ -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --data '{ \ - "context": "tests", \ - "state": "success", \ - "description": "Tests passed", \ - "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + --data '{ + "context": "tests", + "state": "success", + "description": "Tests passed", + "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' \ https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} - name: Tests 🚨 From 8931e94cf8667d0fbeb23303d524447e2d95ed83 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:42:26 -0800 Subject: [PATCH 11/12] update ci post request data for both success and failed cases --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12a66cf..6d874ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: -X POST \ -H 'Accept: application/vnd.github.v3+json' \ -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --data '{ + -d '{ "context": "tests", "state": "success", "description": "Tests passed", @@ -52,12 +52,16 @@ jobs: if: ${{ failure() }} run: | curl \ - -X POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ - "context": "tests", - "state": "failure", - "description": "Tests failed", - "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - }' + -X POST \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + -d '{ + "context": "tests", + "state": "failure", + "description": "Tests failed", + "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} # Code Coverage - name: Code Coverage uses: codecov/codecov-action@v1 From 3b3a87ba60bbc6f79b50421cdcea2af178ded3b8 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Thu, 25 Feb 2021 19:49:49 -0800 Subject: [PATCH 12/12] update ci post request to be as a bash shell command --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d874ec..061f88f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: run: npm run test:ci # conditions with test fails or succeeds - name: Tests ✅ + shell: bash if: ${{ success() }} run: | curl \ @@ -50,6 +51,7 @@ jobs: https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} - name: Tests 🚨 if: ${{ failure() }} + shell: bash run: | curl \ -X POST \