diff --git a/.github/workflows/test-ui-components.yaml b/.github/workflows/test-ui-components.yaml index 39252fb2f6..05912b291b 100644 --- a/.github/workflows/test-ui-components.yaml +++ b/.github/workflows/test-ui-components.yaml @@ -40,7 +40,7 @@ jobs: # 1G = 1073741824 gc-max-store-size-linux: 1G - - run: ./prep-all.sh + - run: ./prep-webapp.sh env: PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID || 'test' }} diff --git a/.github/workflows/test-webapp.yaml b/.github/workflows/test-webapp.yaml index cf18f50bea..6e8813a8ac 100644 --- a/.github/workflows/test-webapp.yaml +++ b/.github/workflows/test-webapp.yaml @@ -40,7 +40,7 @@ jobs: # 1G = 1073741824 gc-max-store-size-linux: 1G - - run: ./prep-all.sh + - run: ./prep-webapp.sh env: PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID || 'test' }} diff --git a/.github/workflows/vercel-preview-pr-target.yaml b/.github/workflows/vercel-preview-pr-target.yaml index d20029b68f..fa1f7ac712 100644 --- a/.github/workflows/vercel-preview-pr-target.yaml +++ b/.github/workflows/vercel-preview-pr-target.yaml @@ -50,7 +50,8 @@ jobs: nix_conf: | keep-env-derivations = true keep-outputs = true - - run: ./prep-all.sh + + - run: ./prep-webapp.sh env: PUBLIC_WALLETCONNECT_PROJECT_ID: test diff --git a/.github/workflows/vercel-preview.yaml b/.github/workflows/vercel-preview.yaml index e7a460ac51..4f362ca351 100644 --- a/.github/workflows/vercel-preview.yaml +++ b/.github/workflows/vercel-preview.yaml @@ -54,7 +54,7 @@ jobs: # 1G = 1073741824 gc-max-store-size-linux: 1G - - run: ./prep-all.sh + - run: ./prep-webapp.sh env: PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }} diff --git a/.github/workflows/vercel-prod.yaml b/.github/workflows/vercel-prod.yaml index 4de7683f74..1143074868 100644 --- a/.github/workflows/vercel-prod.yaml +++ b/.github/workflows/vercel-prod.yaml @@ -37,7 +37,7 @@ jobs: # 1G = 1073741824 gc-max-store-size-linux: 1G - - run: ./prep-all.sh + - run: ./prep-webapp.sh env: PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }} diff --git a/REUSE.toml b/REUSE.toml index d461f5258a..5ddad4187a 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -36,6 +36,7 @@ path = [ "tauri-app/**/", "test-resources/**/", "prep-base.sh", + "prep-webapp.sh", ] SPDX-FileCopyrightText = "Copyright (c) 2020 Rain Open Source Software Ltd" SPDX-License-Identifier = "LicenseRef-DCL-1.0" diff --git a/prep-webapp.sh b/prep-webapp.sh new file mode 100755 index 0000000000..f0b1ae6ec2 --- /dev/null +++ b/prep-webapp.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Set strict error handling +set -euxo pipefail + +echo "Starting project setup..." + +# Environment variables that need to be set (commented out as reference) +# export CI_DEPLOY_SEPOLIA_RPC_URL="" +# export CI_FORK_SEPOLIA_DEPLOYER_ADDRESS="" +# export CI_FORK_SEPOLIA_BLOCK_NUMBER="" +# export CI_DEPLOY_POLYGON_RPC_URL="" +# export CI_SEPOLIA_METABOARD_URL="" +# export RPC_URL_ETHEREUM_FORK="" +# export COMMIT_SHA="" + +# Keep environment variables when using nix-develop +keep=( + -k CI_DEPLOY_SEPOLIA_RPC_URL + -k CI_FORK_SEPOLIA_DEPLOYER_ADDRESS + -k CI_FORK_SEPOLIA_BLOCK_NUMBER + -k CI_DEPLOY_POLYGON_RPC_URL + -k CI_SEPOLIA_METABOARD_URL + -k RPC_URL_ETHEREUM_FORK + -k COMMIT_SHA + -k PUBLIC_WALLETCONNECT_PROJECT_ID +) + +echo "Preparing base setup..." +./prep-base.sh + +echo "Building packages..." +nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/orderbook)' +nix develop -i ${keep[@]} -c bash -c '(npm run build -w @rainlanguage/ui-components && npm run build -w @rainlanguage/webapp)' + +# Temporarily disable command echoing +set +x + +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 + +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# Print the completion message +printf "\033[0;32m" # Set text to green +printf "╔════════════════════════════════════════════════════════════════════════╗\n" +printf "║ Setup Complete! ║\n" +printf "╠════════════════════════════════════════════════════════════════════════╣\n" +printf "║ How to run the apps: ║\n" +printf "║ ║\n" +printf "║ To run webapp: cd packages/webapp && nix develop -c npm run dev ║\n" +printf "╚════════════════════════════════════════════════════════════════════════╝\n" +printf "\033[0m" # Reset text color + +# Re-enable command echoing +set -x