From a03ad9de66fbc49bf09e29b90ba4e4a4f468f425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ducceschi?= Date: Thu, 9 Nov 2023 00:58:17 +0100 Subject: [PATCH] Add basic CI --- .github/actions/package-install/action.yaml | 22 +++++++++++++++++++++ .github/workflows/_build-lint.yaml | 17 ++++++++++++++++ .github/workflows/_docs.yaml | 17 ++++++++++++++++ .github/workflows/_tests.yaml | 17 ++++++++++++++++ .github/workflows/ci.yaml | 16 +++++++++++++++ .npmignore | 1 + 6 files changed, 90 insertions(+) create mode 100644 .github/actions/package-install/action.yaml create mode 100644 .github/workflows/_build-lint.yaml create mode 100644 .github/workflows/_docs.yaml create mode 100644 .github/workflows/_tests.yaml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/actions/package-install/action.yaml b/.github/actions/package-install/action.yaml new file mode 100644 index 0000000..2e689dc --- /dev/null +++ b/.github/actions/package-install/action.yaml @@ -0,0 +1,22 @@ +name: ๐Ÿ“ฅ Install Package +description: Install Node.js, NPM, and the package's NPM dependencies, and cache it. + +runs: + using: composite + steps: + - 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..b5fc36a --- /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: remileduc/vcards-io/.github/actions/package-install@${{github.ref_name}} + + - 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..3ddcde9 --- /dev/null +++ b/.github/workflows/_docs.yaml @@ -0,0 +1,17 @@ +name: ๐Ÿ“™ Documentation + +on: workflow_call + +jobs: + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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..f90cca0 --- /dev/null +++ b/.github/workflows/_tests.yaml @@ -0,0 +1,17 @@ +name: ๐Ÿ“ Tests + +on: workflow_call + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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