Skip to content

Commit

Permalink
Fix deployment after dependency updates (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchristov authored Nov 26, 2023
1 parent 4a007bf commit 0353b8d
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 47 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/check_gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,18 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2 # By default, cache is only saved on the 'master' branch
- name: Build
- name: Build project
run: |
set -o pipefail &&
bash ./scripts/env.sh &&
./gradlew --no-daemon assemble
- name: Build container image
run: |
set -o pipefail &&
docker build -t check .
- name: Artifacts
uses: actions/upload-artifact@v3
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Build
path: |
Expand Down Expand Up @@ -84,4 +89,4 @@ jobs:
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
path: '**/build/test-results/**/TEST-*.xml'
path: '**/build/test-results/**/TEST-*.xml'
45 changes: 23 additions & 22 deletions .github/workflows/deploy_gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2 # By default, cache is only saved on the 'master' branch
- name: Build
run: |
set -o pipefail &&
bash ./scripts/env.sh &&
./gradlew --no-daemon assemble
- name: Artifacts
uses: actions/upload-artifact@v3
with:
name: Build
path: |
build/bin
local.properties
local-credentials-gcp.json
- name: Set up deploy environment
run: |
GCP_BUILD_TAG="${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GCP_REPOSITORY }}/${{ env.GCP_REPOSITORY_IMAGE }}"
echo "GCP_BUILD_TAG=$GCP_BUILD_TAG" >> $GITHUB_ENV
- name: Set up deploy authentication
uses: google-github-actions/[email protected]
with:
Expand All @@ -79,7 +62,19 @@ jobs:
else
echo "Artifact registry repository already exists"
fi
- name: Build and push container image
- name: Set up deploy environment
run: |
GCP_BUILD_TAG="${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GCP_REPOSITORY }}/${{ env.GCP_REPOSITORY_IMAGE }}"
echo "GCP_BUILD_TAG=$GCP_BUILD_TAG" >> $GITHUB_ENV
- name: Build project
run: |
set -o pipefail &&
bash ./scripts/env.sh &&
./gradlew --no-daemon assemble
- name: Build container image
run: |-
docker build -t $GCP_BUILD_TAG .
- name: Push container image
run: |-
gcloud auth configure-docker ${{ env.GCP_REGION }}-docker.pkg.dev
docker build -t $GCP_BUILD_TAG .
Expand All @@ -98,9 +93,15 @@ jobs:
--region ${{ env.GCP_REGION }} \
--member=allUsers \
--role=roles/run.invoker
- name: Deploy output
run: |-
echo "Service available at: ${{ steps.deployment.outputs.url }}"
- name: Artifacts
uses: actions/upload-artifact@v3
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Build
path: |
build/bin
local.properties
local-credentials-gcp.json
jsTest:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -133,4 +134,4 @@ jobs:
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
path: '**/build/test-results/**/TEST-*.xml'
path: '**/build/test-results/**/TEST-*.xml'
2 changes: 1 addition & 1 deletion backend/appBackend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ kotlin {
tasks.named("assemble") {
doLast {
copy {
from(file("${layout.buildDirectory}/productionLibrary"))
from(layout.buildDirectory.dir("packages/js").get().asFile)
into(file("$rootDir/build/bin"))
}
copy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.gchristov.thecodinglove.htmlparsedata.usecase

import arrow.core.Either
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import com.gchristov.thecodinglove.htmlparsedata.HtmlPost
import com.gchristov.thecodinglove.htmlparsetestfixtures.HtmlCreator
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals

@OptIn(ExperimentalCoroutinesApi::class)
class JavascriptParseHtmlPostsUseCaseTest {
@Test
fun parsePosts() = runBlockingTest { parser ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.gchristov.thecodinglove.htmlparsedata.usecase

import arrow.core.Either
import com.gchristov.thecodinglove.htmlparsetestfixtures.HtmlCreator
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import com.gchristov.thecodinglove.htmlparsetestfixtures.HtmlCreator
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

@OptIn(ExperimentalCoroutinesApi::class)
class JavascriptParseHtmlTotalPostsUseCaseTest {
@Test
fun parseTotalPosts() = runBlockingTest { parser ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import com.gchristov.thecodinglove.searchdata.domain.SearchError
import com.gchristov.thecodinglove.searchdata.domain.SearchSession
import com.gchristov.thecodinglove.searchtestfixtures.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals

@OptIn(ExperimentalCoroutinesApi::class)
class RealPreloadSearchResultUseCaseTest {
@Test
fun preloadWithMissingSessionReturnsSessionNotFound(): TestResult {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package com.gchristov.thecodinglove.searchdata.usecase

import arrow.core.Either
import com.gchristov.thecodinglove.commonservicetestfixtures.FakePubSubPublisher
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonservicetestfixtures.FakePubSubPublisher
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import com.gchristov.thecodinglove.searchdata.domain.PreloadSearchPubSubMessage
import com.gchristov.thecodinglove.searchdata.domain.SearchConfig
import com.gchristov.thecodinglove.searchdata.domain.SearchError
import com.gchristov.thecodinglove.searchdata.domain.SearchSession
import com.gchristov.thecodinglove.searchtestfixtures.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals

@OptIn(ExperimentalCoroutinesApi::class)
class RealSearchUseCaseTest {
@Test
fun searchWithNewSessionCreatesNewSession(): TestResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import com.gchristov.thecodinglove.searchdata.domain.SearchConfig
import com.gchristov.thecodinglove.searchdata.domain.SearchError
import com.gchristov.thecodinglove.searchtestfixtures.FakeSearchRepository
import com.gchristov.thecodinglove.searchtestfixtures.PostCreator
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue

@OptIn(ExperimentalCoroutinesApi::class)
class RealSearchWithHistoryUseCaseTest {
@Test
fun searchWithNoResultsReturnsEmpty(): TestResult {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.gchristov.thecodinglove.search

import arrow.core.Either
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonservicetestfixtures.FakePubSubDecoder
import com.gchristov.thecodinglove.commonservicetestfixtures.FakePubSubRequest
import com.gchristov.thecodinglove.commonservicetestfixtures.FakePubSubSubscription
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import com.gchristov.thecodinglove.commontest.FakeLogger
import com.gchristov.thecodinglove.searchdata.domain.PreloadSearchPubSubMessage
Expand All @@ -13,14 +13,12 @@ import com.gchristov.thecodinglove.searchdata.domain.SearchError
import com.gchristov.thecodinglove.searchtestfixtures.FakePreloadSearchResultUseCase
import com.gchristov.thecodinglove.searchtestfixtures.PreloadSearchPubSubCreator
import io.ktor.http.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

@OptIn(ExperimentalCoroutinesApi::class)
class PreloadSearchPubSubHttpHandlerTest {
@Test
fun httpConfig(): TestResult = runBlockingTest(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.gchristov.thecodinglove.search

import arrow.core.Either
import com.gchristov.thecodinglove.commonservicetestfixtures.FakeHttpResponse
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonservicetestfixtures.FakeHttpResponse
import com.gchristov.thecodinglove.commontest.FakeCoroutineDispatcher
import com.gchristov.thecodinglove.commontest.FakeLogger
import com.gchristov.thecodinglove.searchdata.domain.SearchError
Expand All @@ -11,13 +11,11 @@ import com.gchristov.thecodinglove.searchtestfixtures.FakeSearchHttpRequest
import com.gchristov.thecodinglove.searchtestfixtures.FakeSearchUseCase
import com.gchristov.thecodinglove.searchtestfixtures.SearchResultCreator
import io.ktor.http.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals

@OptIn(ExperimentalCoroutinesApi::class)
class SearchHttpHandlerTest {
@Test
fun config(): TestResult = runBlockingTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import com.gchristov.thecodinglove.slackdata.domain.SlackConfig
import com.gchristov.thecodinglove.slackdata.usecase.RealSlackVerifyRequestUseCase
import com.gchristov.thecodinglove.slackdata.usecase.SlackVerifyRequestUseCase
import com.gchristov.thecodinglove.slacktestfixtures.FakeSlackApiRequest
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlin.test.Test
import kotlin.test.assertEquals

@OptIn(ExperimentalCoroutinesApi::class)
class RealVerifySlackRequestUseCaseTest {
@Test
fun verifyWithMissingTimestampReturnsError(): TestResult {
Expand Down
2 changes: 1 addition & 1 deletion client/appWeb/appWeb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
tasks.named("assemble") {
doLast {
copy {
from(file("${layout.buildDirectory}/distributions"))
from(layout.buildDirectory.dir("dist/js/productionExecutable").get().asFile)
into(file("$rootDir/build/bin/web"))
}
}
Expand Down

0 comments on commit 0353b8d

Please sign in to comment.