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
304 changes: 159 additions & 145 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build and Test"
name: 'Build and Test'

on:
pull_request:
Expand All @@ -15,159 +15,173 @@ permissions:
id-token: write

jobs:
js-tests:
name: "JS Tests"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
trunk-check:
name: 'Trunk Check'
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Trunk Check
uses: trunk-io/trunk-action@v1

js-tests:
name: 'JS Tests'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- uses: actions/setup-node@v6.2.0
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock

- name: "Install node modules"
- name: 'Install node modules'
run: |
yarn install
- name: "Run test"
- name: 'Run test'
run: |
yarn test
android-unit-tests:
name: "Android Unit Tests"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Run Android Unit Tests"
working-directory: android
run: ./gradlew test

android-lint:
name: "Android Lint"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Run Android lint"
working-directory: android
run: ./gradlew lint

android-kotlin-lint:
name: "Android kotlin lint"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Run Android kotlin lint"
working-directory: android
run: ./gradlew ktlintCheck

android-sample-app:
name: Android Sample App
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-node@v6.2.0
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock

- name: Install node modules
run: yarn install

- name: Build package
run: yarn dev:pack

- name: Install sample app dependencies
working-directory: sample
run: |
rm -f yarn.lock
yarn install
- name: Run Android sample app
working-directory: sample/android
run: ./gradlew assembleDebug

ios-sample-app:
name: iOS Sample App
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-node@v6.2.0
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable

- name: Set Xcode Toolchain
run: echo "TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault" >> $GITHUB_ENV

- name: Setup iOS Simulator
uses: futureware-tech/simulator-action@v5
id: simulator
with:
model: iPhone 16
os: iOS
os_version: ">=18.0"
wait_for_boot: true
shutdown_after_job: true

- name: Install node modules
run: yarn install

- name: Build package
run: yarn dev:pack

- name: Install sample app dependencies
working-directory: sample
run: |
rm -f yarn.lock
yarn install
- name: Install Ruby dependencies
working-directory: sample
run: bundle install

- name: Build iOS sample app
working-directory: sample/ios
run: |
bundle exec pod install
set -o pipefail && xcodebuild -workspace MParticleSample.xcworkspace \
-configuration Debug \
-scheme MParticleSample \
-destination 'id=${{ steps.simulator.outputs.udid }}' \
-derivedDataPath ios/build \
-UseModernBuildSystem=YES \
build | bundle exec xcpretty -k
pr-notify:
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false
needs:
- android-unit-tests
- android-lint
- android-kotlin-lint
- android-sample-app
- ios-sample-app
- js-tests
name: Notify GChat
uses: ROKT/rokt-workflows/.github/workflows/oss_pr_opened_notification.yml@main
secrets:
gchat_webhook: ${{ secrets.GCHAT_PRS_WEBHOOK }}

automerge-dependabot:
name: "Save PR Number for Dependabot Automerge"
needs: [ js-tests, android-unit-tests, android-lint, android-kotlin-lint ]
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main
android-unit-tests:
name: 'Android Unit Tests'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- name: 'Run Android Unit Tests'
working-directory: android
run: ./gradlew test

android-lint:
name: 'Android Lint'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- name: 'Run Android lint'
working-directory: android
run: ./gradlew lint

android-kotlin-lint:
name: 'Android kotlin lint'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- name: 'Run Android kotlin lint'
working-directory: android
run: ./gradlew ktlintCheck

android-sample-app:
name: Android Sample App
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-node@v6.2.0
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock

- name: Install node modules
run: yarn install

- name: Build package
run: yarn dev:pack

- name: Install sample app dependencies
working-directory: sample
run: |
rm -f yarn.lock
yarn install
- name: Run Android sample app
working-directory: sample/android
run: ./gradlew assembleDebug

ios-sample-app:
name: iOS Sample App
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-node@v6.2.0
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable

- name: Set Xcode Toolchain
run: echo "TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault" >> $GITHUB_ENV

- name: Setup iOS Simulator
uses: futureware-tech/simulator-action@v5
id: simulator
with:
model: iPhone 16
os: iOS
os_version: '>=18.0'
wait_for_boot: true
shutdown_after_job: true

- name: Install node modules
run: yarn install

- name: Build package
run: yarn dev:pack

- name: Install sample app dependencies
working-directory: sample
run: |
rm -f yarn.lock
yarn install
- name: Install Ruby dependencies
working-directory: sample
run: bundle install

- name: Build iOS sample app
working-directory: sample/ios
run: |
bundle exec pod install
set -o pipefail && xcodebuild -workspace MParticleSample.xcworkspace \
-configuration Debug \
-scheme MParticleSample \
-destination 'id=${{ steps.simulator.outputs.udid }}' \
-derivedDataPath ios/build \
-UseModernBuildSystem=YES \
build | bundle exec xcpretty -k
pr-notify:
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false
needs:
- trunk-check
- android-unit-tests
- android-lint
- android-kotlin-lint
- android-sample-app
- ios-sample-app
- js-tests
name: Notify GChat
uses: ROKT/rokt-workflows/.github/workflows/oss_pr_opened_notification.yml@main
secrets:
gchat_webhook: ${{ secrets.GCHAT_PRS_WEBHOOK }}

automerge-dependabot:
name: 'Save PR Number for Dependabot Automerge'
needs: [js-tests, android-unit-tests, android-lint, android-kotlin-lint]
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main
34 changes: 34 additions & 0 deletions .github/workflows/trunk-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run trunk upgrade

on:
workflow_call:
schedule:
- cron: 0 0 1 * *
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
generate-and-call-upgrade:
runs-on: ubuntu-latest
outputs:
generated-token: ${{ steps.generate-token.outputs.token }}
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
with:
app-id: ${{ secrets.SDK_RELEASE_GITHUB_APP_ID }} # trunk-ignore(actionlint/expression)
private-key: ${{ secrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEY }} # trunk-ignore(actionlint/expression)
owner: ${{ github.repository_owner }}
repositories: |
react-native-mparticle
trunk-upgrade:
needs: generate-and-call-upgrade
name: Run trunk upgrade
uses: ROKT/rokt-workflows/.github/workflows/trunk-upgrade.yml@main # trunk-ignore(actionlint/workflow-call)
with:
token: ${{ needs.generate-and-call-upgrade.outputs.generated-token }}
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
10 changes: 10 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154

# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
10 changes: 10 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ['{|}']
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
Loading
Loading