Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
Add x code and ruby version
  • Loading branch information
ksharma-xyz committed Nov 23, 2024
1 parent 4ec5498 commit 7cc2072
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 34 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:

steps:
- uses: actions/checkout@v4
name: Setup environment variables
env:
NSW_TRANSPORT_API_KEY: ${{ secrets.NSW_TRANSPORT_API_KEY }}
run: |
echo "::set-env name=NSW_TRANSPORT_API_KEY::${{ secrets.NSW_TRANSPORT_API_KEY }}"
- name: Setup environment variables
run: |
echo "NSW_TRANSPORT_API_KEY=${{ secrets.NSW_TRANSPORT_API_KEY }}" >> $GITHUB_ENV
- name: set up JDK
uses: actions/setup-java@v4
Expand Down Expand Up @@ -53,16 +51,26 @@ jobs:
# run: ./gradlew detekt

- name: Build Debug
env:
NSW_TRANSPORT_API_KEY: ${{ secrets.NSW_TRANSPORT_API_KEY }}
run: ./gradlew :composeApp:assembleDebug test

- name: Build Release
env:
NSW_TRANSPORT_API_KEY: ${{ secrets.NSW_TRANSPORT_API_KEY }}
run: ./gradlew :composeApp:assembleRelease test

iOS:
runs-on: macos-14
environment: Firebase
timeout-minutes: 60

steps:
- uses: actions/checkout@v4
- name: Setup environment variables
run: |
echo "NSW_TRANSPORT_API_KEY=${{ secrets.NSW_TRANSPORT_API_KEY }}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4

Expand All @@ -72,12 +80,6 @@ jobs:
distribution: 'temurin'
java-version: 21

- name: Set up Kotlin
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand All @@ -88,13 +90,16 @@ jobs:
with:
cache-disabled: true

- name: Build iOS App - Debug
- name: Build iOS App - Debug (Without Code Signing)
env:
NSW_TRANSPORT_API_KEY: ${{ secrets.NSW_TRANSPORT_API_KEY }}
run: |
xcodebuild -project iosApp/iosApp.xcodeproj \
-scheme iosApp \
-configuration Debug \
OBJROOT=$GITHUB_WORKSPACE/build/ios \
SYMROOT=$GITHUB_WORKSPACE/build/ios \
-destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' \
-allowProvisioningDeviceRegistration \
-allowProvisioningUpdates
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
-destination 'platform=iOS Simulator,name=iPhone 12,OS=latest'
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
1 change: 1 addition & 0 deletions .xcode-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15.3
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,12 @@ class DateTimeHelperTest {
assertEquals("2024-10-07T12:00:23", "2024-10-07T01:00:23Z".utcToAEST())
}

/*
@Test
fun testAestToHHMM() {
assertEquals("11:00 AM", "2024-10-07T00:00:00Z".aestToHHMM())
assertEquals("12:00 PM", "2024-10-07T01:00:00Z".aestToHHMM())
}
*/

@Test
fun testToGenericFormattedTimeString() {
assertEquals("40 mins ago", (-40).minutes.toGenericFormattedTimeString())
assertEquals("Now", 0.minutes.toGenericFormattedTimeString())
assertEquals("In 1h 20m", 80.minutes.toGenericFormattedTimeString())
assertEquals("In 2h", 120.minutes.toGenericFormattedTimeString())
assertEquals("in 1h 20m", 80.minutes.toGenericFormattedTimeString())
assertEquals("in 2h", 120.minutes.toGenericFormattedTimeString())
}

@Test
Expand Down
15 changes: 6 additions & 9 deletions feature/trip-planner/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ android {
namespace = "xyz.ksharma.krail.trip.planner.network"

buildTypes {
debug {
buildConfigField("String", "NSW_TRANSPORT_API_KEY", "\"$nswTransportApiKey\"")
}
debug {}

release {
buildConfigField("String", "NSW_TRANSPORT_API_KEY", "\"$nswTransportApiKey\"")
}
release {}
}
}

Expand Down Expand Up @@ -80,15 +76,16 @@ kotlin {

// READ API KEY
val localProperties = gradleLocalProperties(rootProject.rootDir, providers)
val nswTransportApiKey: String = localProperties.getProperty("NSW_TRANSPORT_API_KEY", "")
val nswTransportApiKey: String = localProperties.getProperty("NSW_TRANSPORT_API_KEY")
?: System.getenv("NSW_TRANSPORT_API_KEY")
require(nswTransportApiKey.isNotEmpty()) {
"Register your API key from the developer and place it in local.properties as `API_KEY`"
"Register API key and put in local.properties as `NSW_TRANSPORT_API_KEY`"
}
buildkonfig {
packageName = "xyz.ksharma.krail.trip.planner.network"

require(nswTransportApiKey.isNotEmpty()) {
"Register your api key from developer and place it in local.properties as `API_KEY`"
"Register API key and put in local.properties as `NSW_TRANSPORT_API_KEY`"
}

defaultConfigs {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package xyz.ksharma.krail.trip.planner.ui.timetable.business

import xyz.ksharma.krail.trip.planner.network.api.model.TripResponse
import kotlin.test.Test
import kotlin.test.assertEquals

class PlatformTextTest {

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
android.useAndroidX=true
org.gradle.caching=true
kotlin.native.ignoreDisabledTargets=true

0 comments on commit 7cc2072

Please sign in to comment.