Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Initial Release #5

Merged
merged 12 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
30 changes: 30 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"root": true,
"env": {
"browser": true,
"node": true
},
"globals": {
"mParticle": true,
"gtag": true,
"describe": true,
"Should": true,
"MockHttpServer": true,
"it": true,
"sinon": true,
"const": true,
"before": true,
"beforeEach": true,
"after": true,
"Leanplum": true
},
"extends": ["plugin:prettier/recommended", "eslint:recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"no-prototype-builtins": "off",
"no-empty": "off",
"no-useless-escape": "off",
"no-unexpected-multiline": "off"
}
}
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Summary
{provide a thorough description of the changes}

## Testing Plan
{explain how this has been tested, and what additional testing should be done}

## Master Issue
Closes https://go.mparticle.com/work/REPLACE
32 changes: 32 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Web Kit SDK Build & Test

on: pull_request

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: NPM install
uses: actions/setup-node@v4
with:
node-version: 16.x
SbDove marked this conversation as resolved.
Show resolved Hide resolved

- name: Run NPM CI
run: npm ci

- name: Build Files
run: npm run build

- name: Run Core tests
run: npm run testKarma

- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
152 changes: 152 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Release Kit

on:
workflow_dispatch:
inputs:
dryRun:
description: 'Do a dry run to preview instead of a real release [true/false]'
required: true
default: 'true'

jobs:
# Kit release is done from master branch.
confirm-public-repo-master-branch:
name: 'Confirm release is run from public/master branch'
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable

build-and-test:
name: Build and Test
runs-on: ubuntu-latest
needs: confirm-public-repo-master-branch
steps:
- name: Checkout
uses: actions/checkout@v3

- name: NPM install
uses: actions/setup-node@v3
with:
node-version: 16.x
SbDove marked this conversation as resolved.
Show resolved Hide resolved

- name: Run NPM CI
run: npm ci

- name: Build Files
run: npm run build

- name: Run Core tests
run: npm run test

- name: Archive npm failure logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

create-release-branch:
name: Create release branch
runs-on: ubuntu-latest
needs:
- build-and-test
- confirm-public-repo-master-branch
steps:
- name: Checkout development branch
uses: actions/checkout@v3
with:
repository: mparticle-integrations/mparticle-javascript-integration-heap
ref: development

- name: Create and push release branch
run: |
git checkout -b release/${{ github.run_number }}
git push origin release/${{ github.run_number }}

release:
name: Perform Release
runs-on: ubuntu-latest
needs:
- build-and-test
- create-release-branch
- confirm-public-repo-master-branch
env:
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: [email protected]
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

steps:
- name: Checkout public master branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Merge release branch into master branch
run: |
git pull origin release/${{ github.run_number }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install dependencies
run: npm ci

- name: Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
run: |
npx semantic-release --dry-run
- name: Release
if: ${{ github.event.inputs.dryRun == 'false'}}
run: |
npx semantic-release

- name: Archive npm failure logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

- name: Push automated release commits to release branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:release/${{ github.run_number }}

sync-repository:
name: Sync repositories
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ${{ github.repository }}
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
ref: master

- name: Merge release branch into master branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git pull origin release/${{ github.run_number }}

- name: Push release commits to master and development branches
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:development
git push origin HEAD:master
- name: Delete release branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push --delete origin release/${{ github.run_number }}
15 changes: 15 additions & 0 deletions .github/workflows/reusable-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Reusable Workflows

on:
pull_request:

jobs:
pr-branch-check-name:
name: Check PR for semantic branch name
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-check-name.yml@stable
pr-title-check:
name: Check PR for semantic title
uses: mParticle/mparticle-workflows/.github/workflows/pr-title-check.yml@stable
pr-branch-target-gitflow:
name: Check PR for semantic target branch
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-target-gitflow.yml@stable
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
test/test-bundle.js
.DS_Store
test/end-to-end-testapp/compilation.js
dist/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 4
}
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Contributing

Thanks for contributing! Please read this document to follow our conventions for contributing to the mParticle SDK.

## Setting Up

- Fork the repository and then clone down your fork
- Commit your code per the conventions below, and PR into the mParticle SDK `master` branch
- Your PR title will be checked automatically against the below convention (view the commit history to see examples of a proper commit/PR title). If it fails, you must update your title.
- Our engineers will work with you to get your code change implemented once a PR is up

## PR Title and Commit Convention

PR titles should follow [conventional commit standards](https://www.conventionalcommits.org/). This helps automate the release process.

The standard format for commit messages is as follows:

```
<type>[optional scope]: <description>

[optional body]

[optional footer]
```

The following lists the different `types` allowed in the commit message:

- feat: A new feature (automatic minor release)
- fix: A bug fix (automatic patch release)
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing or correcting existing tests
- chore: Changes that don't modify src or test files, such as automatic documentation generation, or building latest assets
- ci: Changes to CI configuration files/scripts
- revert: Revert commit
- build: Changes that affect the build system or other dependencies

In the footer, if there is a breaking change, start your footer with `BREAKING CHANGE:` followed by a description.

## Running Tests

```bash
$ npm install
$ npm run test // builds mparticle bundles and runs tests
```

There are additional scripts that may improve your development experience:
```bash
$ npm run watch // watches src/ files and continuously rebuilds bundles as changes are made
$ npm run watch:tests // watches test/ files and continuously rebuilds test bundles as changes are made
$ npm run test:debug // opens a browser so you can step through mParticle and test code
```
Loading
Loading