From ca46158d688f423f9192631ee991f9b60cddae92 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 12 Oct 2023 00:07:12 +0000 Subject: [PATCH] chore: add lint & fmt to ci/cd --- .github/workflows/node.js.yml | 31 +++++++++++++++++++++++++++++++ _scripts/install-ci-deps | 9 +++++++++ 2 files changed, 40 insertions(+) create mode 100644 .github/workflows/node.js.yml create mode 100755 _scripts/install-ci-deps diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..7313a9b --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +name: Node.js CI +on: + push: + branches: ['main'] + pull_request: +jobs: + build: + name: "Fmt, Lint, & Test" + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 20.x + - latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: "Webi: Install 'shfmt' and 'shellcheck', and update PATH" + run: | + sh ./_scripts/install-ci-deps + echo "${HOME}/.local/bin" >> $GITHUB_PATH + - run: shfmt --version + - run: shellcheck -V + - run: node --version + - run: npm run fmt + - run: npm ci + - run: npm run lint + - run: npm run test diff --git a/_scripts/install-ci-deps b/_scripts/install-ci-deps new file mode 100755 index 0000000..d7d8b63 --- /dev/null +++ b/_scripts/install-ci-deps @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +set -u + +# Install 'shfmt 3.7.x' +curl -fsS https://webi.sh/shfmt@3.7 | sh + +# Install 'shellcheck v0.9.x' +curl -fsS https://webi.sh/shellcheck@0.9 | sh