diff --git a/.github/actions/package-install/action.yaml b/.github/actions/package-install/action.yaml new file mode 100644 index 0000000..b745330 --- /dev/null +++ b/.github/actions/package-install/action.yaml @@ -0,0 +1,25 @@ +name: ๐Ÿ“ฅ Install Package +description: Install Node.js, NPM, and the package's NPM dependencies, and cache it. + +runs: + using: composite + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + cache: "npm" + + - name: Output versions + shell: bash + run: | + echo Node and NPM versions + node --version + npm --version + + - name: Install NPM dependencies + shell: bash + run: npm install diff --git a/.github/workflows/_build-lint.yaml b/.github/workflows/_build-lint.yaml new file mode 100644 index 0000000..f7e7dac --- /dev/null +++ b/.github/workflows/_build-lint.yaml @@ -0,0 +1,17 @@ +name: โš’๏ธ Build - ๐Ÿงน Lint + +on: workflow_call + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฅ Install + uses: ./.github/actions/package-install + + - name: Build + run: npm run build + + - name: Lint + run: npm run lint diff --git a/.github/workflows/_docs.yaml b/.github/workflows/_docs.yaml new file mode 100644 index 0000000..c80e731 --- /dev/null +++ b/.github/workflows/_docs.yaml @@ -0,0 +1,14 @@ +name: ๐Ÿ“™ Documentation + +on: workflow_call + +jobs: + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฅ Install + uses: ./.github/actions/package-install + + - name: Biuld documentation + run: npm run doc diff --git a/.github/workflows/_tests.yaml b/.github/workflows/_tests.yaml new file mode 100644 index 0000000..91dbe00 --- /dev/null +++ b/.github/workflows/_tests.yaml @@ -0,0 +1,14 @@ +name: ๐Ÿ“ Tests + +on: workflow_call + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฅ Install + uses: ./.github/actions/package-install + + - name: Run tests + run: npm test diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..812bd16 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,16 @@ +name: โš™๏ธ CI + +on: push + +jobs: + call-build-lint: + name: โš’๏ธ Build - ๐Ÿงน Lint + uses: ./.github/workflows/_build-lint.yaml + + call-tests: + name: ๐Ÿ“ Tests + uses: ./.github/workflows/_tests.yaml + + call-docs: + name: ๐Ÿ“™ Documentation + uses: ./.github/workflows/_docs.yaml diff --git a/.npmignore b/.npmignore index 338ccb3..67fb6f2 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ # config +.github/ .clang-format .editorconfig .eslintrc.json