Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request papers/airgap/airgap-wallet!706
  • Loading branch information
godenzim committed Aug 28, 2023
2 parents 7777b54 + c9f89ba commit 94ce974
Show file tree
Hide file tree
Showing 22 changed files with 688 additions and 649 deletions.
121 changes: 64 additions & 57 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ variables:
stages:
- build
- test
- qa
# - qa
- platform_build
- publish
- deploy
Expand Down Expand Up @@ -101,60 +101,60 @@ build-ios:
tags:
- ios

build-mac:
stage: platform_build
when: manual
script:
- 'sed -i -e "s/\"version\": \"0.0.1\"/\"version\": \"${VERSION}\"/g" electron/package.json'
- nvm use 16
- npm install
- npm run prepare-prod-build
- npm --prefix electron/ install
- npm run build:electron:prod
- npx cap sync electron
- npm --prefix electron/ run build:mac
artifacts:
name: 'electron_macos'
paths:
- electron/build/airgap-wallet-$VERSION.dmg
- electron/build/airgap-wallet-$VERSION.dmg.blockmap
- electron/build/airgap-wallet-$VERSION-mac.zip
tags:
- ios

build-linux:
stage: platform_build
when: manual
variables:
LOCAL_LINUX: 'linux-$CI_PIPELINE_ID'
script:
- docker build -f build/electron/linux/Dockerfile -t $GOOGLE_TAG_ELECTRON_LINUX_CURRENT --build-arg VERSION="$VERSION" .
- docker run --name $LOCAL_LINUX $GOOGLE_TAG_ELECTRON_LINUX_CURRENT echo "container ran."
- docker cp $LOCAL_LINUX:/app/electron/build/airgap-wallet-$VERSION.AppImage electron/airgap-wallet-$VERSION.AppImage
after_script:
- docker rm -f $LOCAL_LINUX || true
artifacts:
name: 'electron_linux'
paths:
- electron/airgap-wallet-$VERSION.AppImage

build-windows:
stage: platform_build
when: manual
variables:
LOCAL_WINDOWS: 'windows-$CI_PIPELINE_ID'
script:
- docker build -f build/electron/windows/Dockerfile -t $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT --build-arg VERSION="$VERSION" .
- docker run --name $LOCAL_WINDOWS $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT echo "container ran."
- docker cp $LOCAL_WINDOWS:/app/electron/build/airgap-wallet-$VERSION.exe electron/airgap-wallet-$VERSION.exe
- docker cp $LOCAL_WINDOWS:/app/electron/build/airgap-wallet-$VERSION.exe.blockmap electron/airgap-wallet-$VERSION.exe.blockmap
after_script:
- docker rm -f $LOCAL_WINDOWS || true
artifacts:
name: 'electron_windows'
paths:
- electron/airgap-wallet-$VERSION.exe
- electron/airgap-wallet-$VERSION.exe.blockmap
# build-mac:
# stage: platform_build
# when: manual
# script:
# - 'sed -i -e "s/\"version\": \"0.0.1\"/\"version\": \"${VERSION}\"/g" electron/package.json'
# - nvm use 16
# - npm install
# - npm run prepare-prod-build
# - npm --prefix electron/ install
# - npm run build:electron:prod
# - npx cap sync electron
# - npm --prefix electron/ run build:mac
# artifacts:
# name: 'electron_macos'
# paths:
# - electron/build/airgap-wallet-$VERSION.dmg
# - electron/build/airgap-wallet-$VERSION.dmg.blockmap
# - electron/build/airgap-wallet-$VERSION-mac.zip
# tags:
# - ios

# build-linux:
# stage: platform_build
# when: manual
# variables:
# LOCAL_LINUX: 'linux-$CI_PIPELINE_ID'
# script:
# - docker build -f build/electron/linux/Dockerfile -t $GOOGLE_TAG_ELECTRON_LINUX_CURRENT --build-arg VERSION="$VERSION" .
# - docker run --name $LOCAL_LINUX $GOOGLE_TAG_ELECTRON_LINUX_CURRENT echo "container ran."
# - docker cp $LOCAL_LINUX:/app/electron/build/airgap-wallet-$VERSION.AppImage electron/airgap-wallet-$VERSION.AppImage
# after_script:
# - docker rm -f $LOCAL_LINUX || true
# artifacts:
# name: 'electron_linux'
# paths:
# - electron/airgap-wallet-$VERSION.AppImage

# build-windows:
# stage: platform_build
# when: manual
# variables:
# LOCAL_WINDOWS: 'windows-$CI_PIPELINE_ID'
# script:
# - docker build -f build/electron/windows/Dockerfile -t $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT --build-arg VERSION="$VERSION" .
# - docker run --name $LOCAL_WINDOWS $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT echo "container ran."
# - docker cp $LOCAL_WINDOWS:/app/electron/build/airgap-wallet-$VERSION.exe electron/airgap-wallet-$VERSION.exe
# - docker cp $LOCAL_WINDOWS:/app/electron/build/airgap-wallet-$VERSION.exe.blockmap electron/airgap-wallet-$VERSION.exe.blockmap
# after_script:
# - docker rm -f $LOCAL_WINDOWS || true
# artifacts:
# name: 'electron_windows'
# paths:
# - electron/airgap-wallet-$VERSION.exe
# - electron/airgap-wallet-$VERSION.exe.blockmap

build-web:
stage: platform_build
Expand All @@ -167,6 +167,8 @@ build-web:
publish-ios:
stage: publish
when: manual
needs:
- build-ios
before_script:
- echo "$IOS_EXPORT_OPTIONS" > exportOptions.plist
script:
Expand All @@ -180,17 +182,19 @@ publish-web-dev:
stage: publish
extends: .publish-dev
when: manual
only:
- develop
needs:
- build-web


publish-web-prod:
stage: publish
extends: .publish-prod
when: manual
needs:
- build-web
only:
- master
- main

deploy-web-dev:
stage: deploy
Expand Down Expand Up @@ -221,3 +225,6 @@ deploy-web-prod:
- kubectl apply -f k8s/airgap-wallet/common/namespace.yaml
- kubectl apply -f k8s/airgap-wallet/production/ --recursive
- kubectl apply -f k8s/airgap-wallet/common/ --recursive
only:
- master
- main
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class IsolatedModules : Plugin() {
JSObject("""
{
"type": "success",
"value": ${value.get("value")}
"value": ${value.get("value").serialize()}
}
""".trimIndent())
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.getcapacitor.JSArray
import com.getcapacitor.JSObject
import it.airgap.wallet.plugin.isolatedmodules.js.environment.JSEnvironment
import it.airgap.wallet.util.assign
import it.airgap.wallet.util.toJson
import it.airgap.wallet.util.toJS
import java.util.*

sealed interface JSModule {
Expand Down Expand Up @@ -74,7 +74,7 @@ sealed interface JSModuleAction {
override fun toJson(): String = JSObject("""
{
"type": "$TYPE",
"protocolType": ${protocolType?.toString().toJson()},
"protocolType": ${protocolType?.toString().toJS()},
"ignoreProtocols": ${ignoreProtocols ?: "[]"}
}
""".trimIndent()).toString()
Expand Down Expand Up @@ -125,7 +125,7 @@ sealed interface JSModuleAction {
JSCallMethodTarget.OnlineProtocol, JSObject("""
{
protocolIdentifier: "$protocolIdentifier",
networkId: ${networkId.toJson()}
networkId: ${networkId.toJS()}
}
""".trimIndent())
)
Expand All @@ -139,7 +139,7 @@ sealed interface JSModuleAction {
JSCallMethodTarget.BlockExplorer, JSObject("""
{
protocolIdentifier: "$protocolIdentifier",
networkId: ${networkId.toJson()}
networkId: ${networkId.toJS()}
}
""".trimIndent())
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package it.airgap.wallet.util

fun Any.serialize(): Any = when (this) {
is String -> "\"$this\""
else -> toString()
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package it.airgap.wallet.util

fun String?.toJson(): Any = this?.let { "\"$it\"" } ?: JSUndefined
fun String?.toJS(): Any = this?.serialize() ?: JSUndefined
6 changes: 4 additions & 2 deletions build/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.13.1 as build
FROM node:16.19.1 as build

# create app directory
RUN mkdir /app
Expand All @@ -12,9 +12,11 @@ COPY apply-diagnostic-modules.js /app
COPY fix-qrscanner-gradle.js /app
COPY patch-dependency-versions.js /app
COPY patch-coinlib.js /app
COPY copy-builtin-modules.js /app
COPY browserify-coinlib.js /app

# install dependencies
RUN npm install
RUN npm install --legacy-peer-deps

# browserify coin-lib
RUN npm run browserify-coinlib
Expand Down
Loading

0 comments on commit 94ce974

Please sign in to comment.