Skip to content

🚀 Template to build your next destination function | Jest + ESLint + Prettier + Husky + GitHub Actions

Notifications You must be signed in to change notification settings

segment-services-eng/destination-function-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Segment_Functions

Destination Function Template

Base template to deploy your next destination function with

  1. Click Use This Template above (If Segment PS, add to Segment Services Engineering Organization

Setup Steps

  1. nvm use (to get the right version of NodeJS)
  2. npm install (to install npm dependencies)

To Test

npm run test

  • GitHub Actions workflow also runs tests before deploying
  • Tests are created in src/index.test.js

To Deploy via GitHub Actions

  1. Create GitHub Environments here (DEV, QA, PROD, etc)
    • DEV is enabled by default in the deployDestinationFunction.yml file (note: this links to the environments in the Template Repo)
    • Navigate to settings -> environments in your Function Repo
  2. Create Function in Segment Workspace
  3. Create Public API Token to allow for deploying
  4. Add the following Environment Secrets
    • FUNCTION_ID
      • Be sure to include dfn_
    • PUBLIC_API_TOKEN

Deploying to multiple environments

  1. Once changes look good in the DEV environment, uncomment the QA section from the deployDestinationFunction.yml file.
  2. Push changes to your branch
  3. Add the label !!_RELEASE_TO_QA to the PR to deploy it to QA

Tooling Included

  1. Jest for code testing
  2. Prettier for code formatting
  3. ESLint for code linting
  4. GitHub Actions script for function deploy
  5. Husky for commit validation

About

🚀 Template to build your next destination function | Jest + ESLint + Prettier + Husky + GitHub Actions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •