From 6807bc2707ee9270a1d749c211285a2ed84509fd Mon Sep 17 00:00:00 2001 From: Alfred Nwanokwai Date: Tue, 11 Jul 2023 03:38:42 +0100 Subject: [PATCH 1/4] Create node.js.yml --- .github/workflows/node.js.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 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..b1ce32d --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# 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: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x, 18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test From 9e973c9e1729b799441e66989e289998d15a3855 Mon Sep 17 00:00:00 2001 From: Alfred Nwanokwai Date: Tue, 11 Jul 2023 11:10:12 +0100 Subject: [PATCH 2/4] chore: Fix bug in Node.js CI workflow This commit fixes a bug in the Node.js CI workflow by updating the versions of the actions/checkout and actions/setup-node actions to @v2. Additionally, indentation inconsistencies were resolved, and the unnecessary cache: 'npm' parameter was removed. The workflow is now ready for use and will properly run the build and test steps across different versions of Node.js. --- .github/workflows/node.js.yml | 36 ++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index b1ce32d..804183b 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -11,21 +11,35 @@ on: jobs: build: - runs-on: ubuntu-latest strategy: matrix: node-version: [14.x, 16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build --if-present - - run: npm test + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache Node.js dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci + + - name: Run build + run: npm run build --if-present + + - name: Run tests + run: npm test From 93cbc1f0d30f257264ee15f16d67e6245a4405be Mon Sep 17 00:00:00 2001 From: Alfred Nwanokwai Date: Tue, 11 Jul 2023 12:43:21 +0100 Subject: [PATCH 3/4] Update node.js.yml --- .github/workflows/node.js.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 804183b..da3cc31 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -34,6 +34,9 @@ jobs: restore-keys: | ${{ runner.os }}-node-${{ matrix.node-version }}- ${{ runner.os }}-node- + + - name: Clear npm cache + run: npm cache clean --force - name: Install dependencies run: npm ci From 8a7d4194e35d4c26b1f5dd2a086c5fb5172b028c Mon Sep 17 00:00:00 2001 From: Alfred Nwanokwai Date: Wed, 12 Jul 2023 22:11:17 +0100 Subject: [PATCH 4/4] Update node.js.yml --- .github/workflows/node.js.yml | 49 +++++++++++------------------------ 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index da3cc31..64547a3 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,13 +1,14 @@ -# 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 +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Node.js CI +name: Build on: - push: - branches: [ "master" ] + create: + tags: + - v* pull_request: - branches: [ "master" ] + branches: [ master ] jobs: build: @@ -18,31 +19,11 @@ jobs: node-version: [14.x, 16.x, 18.x] steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Cache Node.js dependencies - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}-node- - - - name: Clear npm cache - run: npm cache clean --force - - - name: Install dependencies - run: npm ci - - - name: Run build - run: npm run build --if-present - - - name: Run tests - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm install sass express + - run: npm run build