Skip to content

Commit

Permalink
feat: base of GitHub workflows (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinpaypal committed Sep 27, 2023
1 parent d72ccee commit c32defe
Show file tree
Hide file tree
Showing 78 changed files with 735 additions and 426 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ indent_style = tab
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_standard_keyword-spacing = disabled
ktlint_standard_annotation = disabled
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build
on: [pull_request, workflow_dispatch]

concurrency:
group: build-${{ github.event.number }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint
on: [pull_request, workflow_dispatch]

concurrency:
group: lint-${{ github.event.number }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
19 changes: 0 additions & 19 deletions .github/workflows/lintAndUnit.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release
on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
lint:
uses: paypal/paypal-messages-android/.github/workflows/lint.yml@release

test:
uses: paypal/paypal-messages-android/.github/workflows/test.yml@release

build:
uses: paypal/paypal-messages-android/.github/workflows/build.yml@release

release:
name: Release
needs: [linting, tests, build]
runs-on: ubuntu-latest

permissions:
contents: write
issues: write
pull-requests: write

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
# pulls all commits (needed for semantic release to correctly version)
fetch-depth: '0'
persist-credentials: false

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Install Dependencies
run: |
npm i -g @semantic-release/exec @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits@6.1.0
- name: GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release@21

- name: Publish to Maven
run: echo "Publish to Maven"
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test
on: [pull_request, workflow_dispatch]

concurrency:
group: test-${{ github.event.number }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Install Dependencies
run: echo "Install Dependencies"

- name: Run Tests
run: echo "Run Tests"
4 changes: 4 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jmailen.kotlinter'
}

android {
Expand All @@ -10,7 +11,7 @@ android {
defaultConfig {
applicationId "com.paypal.messagesdemo"
minSdk 23
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -59,24 +60,24 @@ android {
}

dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.0')
implementation platform('androidx.compose:compose-bom:2023.06.01')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation platform('androidx.compose:compose-bom:2023.09.00')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation 'androidx.compose.ui:ui:1.5.0'
implementation 'androidx.compose.ui:ui-graphics:1.5.0'
implementation 'androidx.compose.ui:ui-tooling-preview:1.5.0'
implementation 'androidx.compose.material3:material3:1.1.1'
implementation 'androidx.compose.ui:ui:1.5.1'
implementation 'androidx.compose.ui:ui-graphics:1.5.1'
implementation 'androidx.compose.ui:ui-tooling-preview:1.5.1'
implementation 'androidx.compose.material3:material3:1.1.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation project(':library')

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2023.06.01')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.5.0'
debugImplementation 'androidx.compose.ui:ui-tooling:1.5.0'
debugImplementation 'androidx.compose.ui:ui-test-manifest:1.5.0'
androidTestImplementation platform('androidx.compose:compose-bom:2023.09.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.5.1'
debugImplementation 'androidx.compose.ui:ui-tooling:1.5.1'
debugImplementation 'androidx.compose.ui:ui-test-manifest:1.5.1'
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.paypal.messagesdemo

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/java/com/paypal/messagesdemo/Dropdown.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ fun <T> Dropdown(label: String, value: T, options: Array<T>, onValueChange: (T)
Button(
onClick = { expanded = !expanded },
shape = RectangleShape,
modifier = Modifier.width(200.dp)
modifier = Modifier.width(200.dp),
) {
Text("$label: $value")
}
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
modifier = Modifier.width(200.dp)
modifier = Modifier.width(200.dp),
) {
options.forEach { option ->
DropdownMenuItem(
text = { Text(option.toString()) },
onClick = {
onValueChange(option)
expanded = false
}
},
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/java/com/paypal/messagesdemo/JetpackActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.paypal.messagesdemo.ui.BasicTheme
import com.paypal.messages.Logo
import com.paypal.messages.LogoAsset
import com.paypal.messages.PayPalMessageView
import com.paypal.messages.config.ProductGroup
import com.paypal.messages.config.message.style.PayPalMessageColor
import com.paypal.messages.config.message.style.PayPalMessageLogoType
import com.paypal.messages.config.ProductGroup
import com.paypal.messages.PayPalMessageView
import com.paypal.messagesdemo.ui.BasicTheme

class JetpackActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
18 changes: 9 additions & 9 deletions demo/src/main/java/com/paypal/messagesdemo/XmlActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.paypal.messages.PayPalMessageView
import com.paypal.messages.config.PayPalEnvironment as Environment
import com.paypal.messages.config.message.style.PayPalMessageAlign
import com.paypal.messages.config.message.style.PayPalMessageColor
import com.paypal.messages.config.message.style.PayPalMessageLogoType
import com.paypal.messages.config.PayPalMessageOfferType
import com.paypal.messages.config.message.PayPalMessageConfig
import com.paypal.messages.config.message.PayPalMessageData
import com.paypal.messages.config.message.PayPalMessageEvents
import com.paypal.messages.config.message.PayPalMessageStyle
import com.paypal.messages.config.message.PayPalMessageViewState
import com.paypal.messages.config.message.style.PayPalMessageAlign
import com.paypal.messages.config.message.style.PayPalMessageColor
import com.paypal.messages.config.message.style.PayPalMessageLogoType
import com.paypal.messagesdemo.databinding.ActivityMessageBinding
import com.paypal.messages.config.PayPalEnvironment as Environment

class XmlActivity: AppCompatActivity() {
class XmlActivity : AppCompatActivity() {
private lateinit var binding: ActivityMessageBinding
private val TAG = "XmlActivity"

Expand All @@ -39,14 +39,14 @@ class XmlActivity: AppCompatActivity() {
Log.d(TAG, "onLoading")
progressBar.visibility = View.VISIBLE
reloadButton.isEnabled = false
Toast.makeText(this, "Loading Content...",Toast.LENGTH_SHORT).show()
Toast.makeText(this, "Loading Content...", Toast.LENGTH_SHORT).show()
},
onError = {
Log.d(TAG, "onError")
progressBar.visibility = View.INVISIBLE
runOnUiThread {
reloadButton.isEnabled = true
Toast.makeText(this, it.javaClass.toString() + ":" + it.message + ":" + it.paypalDebugId,Toast.LENGTH_LONG).show()
Toast.makeText(this, it.javaClass.toString() + ":" + it.message + ":" + it.paypalDebugId, Toast.LENGTH_LONG).show()
}
it.message?.let { it1 -> Log.d("XmlActivity Error", it1) }
it.paypalDebugId?.let { it1 -> Log.d("XmlActivity Error", it1) }
Expand All @@ -58,8 +58,8 @@ class XmlActivity: AppCompatActivity() {
reloadButton.isEnabled = true
Toast.makeText(this, "Success Getting Content", Toast.LENGTH_SHORT).show()
}
}
)
},
),
)
}

Expand Down

0 comments on commit c32defe

Please sign in to comment.