Skip to content

Commit

Permalink
tyro pay api react native example app
Browse files Browse the repository at this point in the history
  • Loading branch information
dtelfer-tyro authored and JaimeS98 committed Feb 28, 2024
0 parents commit f619762
Show file tree
Hide file tree
Showing 90 changed files with 19,900 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .ci_steps/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

npm run install:all
npm run lint
npm audit --production
npm test
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};
101 changes: 101 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: ":static-code-analysis:CodeQL"
run-name: ":static-code-analysis"

on:
push:
branches: [master]
pull_request:
branches: ['**']

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
# TO DO: add in swift and c-cpp when iOS files added to project
language: [ 'java-kotlin', 'javascript-typescript']
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:

- name: Install SSH Client 🔑
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


- if: matrix.language == 'c-cpp' || matrix.language == 'swift' || matrix.language == 'javascript-typescript'
name: Autobuild
uses: github/codeql-action/autobuild@v2
- if: matrix.language == 'java-kotlin'
name: Build Java
run: |
npm ci
cd android
chmod +x ./gradlew
./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off clean build
env:
GITHUB_PACKAGES_USER: ${{ github.actor }}
GITHUB_PACKAGES_TOKEN: ${{ secrets.PACKAGE_READ_PAT }}

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
26 changes: 26 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
run-name: 'Security Check'
on:
pull_request:
branches: ['**']

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
with:
# Possible values: "critical", "high", "moderate", "low"
fail-on-severity: moderate
110 changes: 110 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: e2e:tests
run-name: :integration:tests

on:
push:
branches: [master]
pull_request:
branches: ['**']

env:
GITHUB_PACKAGES_USER: ${{ github.actor }}
GITHUB_PACKAGES_TOKEN: ${{ secrets.PACKAGE_READ_PAT }}

jobs:
android-e2e:
runs-on: macos-latest

steps:
- name: Setup Node.js env
uses: actions/[email protected]
with:
node-version: 18.0.0

- name: Install SSH Client 🔑
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v3

- name: Install React Native CLI
run: npm install react-native-cli

- name: Setup Java env
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'

- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: Install Maestro CLI
run: curl -Ls "https://get.maestro.mobile.dev" | bash

- name: Add Maestro to path
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH

- name: Install Dependencies and build android
run: |
npm run install:no-pods
- name: Run Android Emulator and app
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
target: google_apis
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
npm run android:release
npm run test:e2e:android
ios-e2e:
runs-on: macos-14

steps:

- name: Install SSH Client 🔑
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v3

- name: Get package cache directory path
id: package-cache-dir-path
run: echo "::set-output name=dir::$(package cache dir)"

- name: Install React Native CLI
run: npm install react-native-cli

- name: Install Maestro CLI
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
brew tap facebook/fb
brew install facebook/fb/idb-companion
- name: Add Maestro to path
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH

- name: Install Dependencies
run: npm run install:all

- name: Run iOS Emulator and app
run: |
npm run ios:release
npm run test:e2e:ios
- name: Stop Emulator
run: killall "Simulator"
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# OSX
#
.DS_Store
.env

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run precommit
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run prepush
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tyro:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ignore artifacts:
build
coverage
dist
*/vendor/bundle/*
vendor/bundle/*

# ignore native files
ios
android

# ingore yaml files:
*.yaml
*.yml

# ignore json files in test fixture directories:
**/tests/fixtures/*.json
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"singleQuote": true
}
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.13'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
Loading

0 comments on commit f619762

Please sign in to comment.