Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/_init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Initialize build

on:
workflow_call:
outputs:
NODE_VERSION:
value: ${{ jobs.init.outputs.NODE_VERSION }}
NODE_CACHE_KEY:
value: ${{ jobs.init.outputs.NODE_CACHE_KEY }}

jobs:
init:
name: Initialize build
runs-on: ubuntu-latest

outputs:
NODE_VERSION: ${{ steps.node-version.outputs.NODE_VERSION }}
NODE_CACHE_KEY: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
fetch-depth: 0

- name: Get node version
id: node-version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)

- name: Get node cache key
id: node-cache-key
run: echo ::set-output name=NODE_CACHE_KEY::npm-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('**/package.json') }}

- name: Cache dependencies
id: cache-node-modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: node_modules
key: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}

- name: Setup node
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: ${{ steps.node-version.outputs.NODE_VERSION }}

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install

- name: Log results
run: |
echo "NODE_VERSION: ${{ steps.node-version.outputs.NODE_VERSION }}"
echo "NODE_CACHE_KEY: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}"
40 changes: 40 additions & 0 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release package

on:
workflow_call:
inputs:
NODE_VERSION:
type: string
required: true
NODE_CACHE_KEY:
type: string
required: true

jobs:
test:
name: Release package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5

- name: Load dependencies from cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: node_modules
key: ${{ inputs.NODE_CACHE_KEY }}

- name: Setup node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: ${{ inputs.NODE_VERSION }}

- name: Run build
run: npm run build

- name: Run release
run: npm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run tests

on:
workflow_call:
inputs:
NODE_VERSION:
type: string
required: true
NODE_CACHE_KEY:
type: string
required: true

jobs:
test:
name: Run tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
test: [lint, test]

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5

- name: Load dependencies from cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: node_modules
key: ${{ inputs.NODE_CACHE_KEY }}

- name: Setup node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "${{ inputs.NODE_VERSION }}"

- name: Run ${{ matrix.test }} test
run: npm run ${{ matrix.test }}
18 changes: 18 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Development

on:
pull_request:
branches: [master, main]

jobs:
init:
name: Init
uses: ./.github/workflows/_init.yml

test:
name: Test
uses: ./.github/workflows/_test.yml
needs: [init]
with:
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
branches: [master, main]

jobs:
init:
name: Init
uses: ./.github/workflows/_init.yml

test:
name: Test
uses: ./.github/workflows/_test.yml
needs: [init]
with:
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}

release:
name: Release
uses: ./.github/workflows/_release.yml
needs: [init, test]
with:
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
secrets: inherit
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# suite-js-sdk

[![Codeship Status for emartech/suite-js-sdk](https://codeship.com/projects/754d4680-a546-0132-cbce-72e52541da30/status?branch=master)](https://codeship.com/projects/66642)
[![Dependency Status](https://david-dm.org/emartech/suite-js-sdk.svg)](https://david-dm.org/emartech/suite-js-sdk)

Simple Javascript wrapper for the Emarsys API.

> Important: This library does not support WSSE authentication. It is intended only to be used by Emarsys add-ons and internal services.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"test": "npm run test:unit",
"test:unit": "NODE_ENV=test mocha --reporter spec --ui bdd $(find . -name \"*.spec.js\" -not -path \"./node_modules/*\")",
"code-style": "eslint --fix .",
"lint": "eslint --fix .",
"validate-commit-msg": "validate-commit-msg",
"semantic-release": "semantic-release",
"audit": "better-npm-audit audit"
Expand All @@ -30,7 +30,7 @@
"node": ">=20"
},
"pre-commit": [
"code-style",
"lint",
"validate-commit-msg"
],
"homepage": "https://github.com/emartech/suite-js-sdk",
Expand Down
Loading