diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a243a18..b4112a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: integration: name: Integration Tests runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, 'integration') || github.ref == 'refs/heads/main' + if: contains(github.event.pull_request.labels.*.name, 'integration') || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'develop') needs: build timeout-minutes: 15 services: diff --git a/site/.vitepress/config.ts b/site/.vitepress/config.ts index 82fac36..0779f62 100644 --- a/site/.vitepress/config.ts +++ b/site/.vitepress/config.ts @@ -1,6 +1,46 @@ +import { readFileSync } from 'node:fs' +import { resolve } from 'node:path' import { defineConfig } from 'vitepress' import type { DefaultTheme } from 'vitepress' +function loadEnvVar(name: string): string { + const fromEnv = process.env[name] + if (fromEnv) return fromEnv + try { + const envFile = readFileSync(resolve(__dirname, '../.env'), 'utf-8') + const match = envFile.match(new RegExp(`^${name}=(.+)$`, 'm')) + return match?.[1]?.trim() || '' + } catch { + return '' + } +} + +const plausibleDomain = + loadEnvVar('VITE_PLAUSIBLE_DOMAIN') || 'reactive.growae.io' +const plausibleHost = + loadEnvVar('VITE_PLAUSIBLE_ENDPOINT') || 'https://plausible.growae.io' + +const headEntries: ReturnType['head'] = [ + ['meta', { property: 'og:title', content: 'Reactive' }], + [ + 'meta', + { + property: 'og:description', + content: 'Type-safe Aeternity blockchain interactions', + }, + ], + ['meta', { property: 'og:type', content: 'website' }], + ['link', { rel: 'stylesheet', href: '/styles/custom.css' }], + [ + 'script', + { + defer: '', + 'data-domain': plausibleDomain, + src: `${plausibleHost.replace(/\/+$/, '')}/js/script.js`, + }, + ], +] + export default defineConfig({ title: 'Reactive', description: @@ -8,18 +48,7 @@ export default defineConfig({ cleanUrls: true, lastUpdated: true, - head: [ - ['meta', { property: 'og:title', content: 'Reactive' }], - [ - 'meta', - { - property: 'og:description', - content: 'Type-safe Aeternity blockchain interactions', - }, - ], - ['meta', { property: 'og:type', content: 'website' }], - ['link', { rel: 'stylesheet', href: '/styles/custom.css' }], - ], + head: headEntries as any, themeConfig: { nav: [ diff --git a/test/config/aeternity.yaml b/test/config/aeternity.yaml index 2d4ecdb..aee00f9 100644 --- a/test/config/aeternity.yaml +++ b/test/config/aeternity.yaml @@ -6,6 +6,9 @@ chain: persist: false hard_forks: "1": 0 + genesis_accounts: + ak_2CuofqWZHrABCrM7GY95YSQn8PyFvKQadnvFnpwhjUnDCFAWmf: 100000000000000000000000000000 + ak_tWZrf8ehmY7CyB1JAoBmWJEeThwWnDpU4NadUdzxVSbzDgKjP: 100000000000000000000000000000 mining: autostart: true diff --git a/test/integration/spend.integration.test.ts b/test/integration/spend.integration.test.ts index 657d120..5cfb78b 100644 --- a/test/integration/spend.integration.test.ts +++ b/test/integration/spend.integration.test.ts @@ -3,6 +3,9 @@ import { connect } from '../../packages/core/src/actions/connect' import { spend } from '../../packages/core/src/actions/spend' import { createTestConfig, waitForNode } from '../setup/integration' +// Second genesis-funded account from test/config/aeternity.yaml — receives the spend tx +const RECIPIENT = 'ak_tWZrf8ehmY7CyB1JAoBmWJEeThwWnDpU4NadUdzxVSbzDgKjP' + describe.skipIf(!process.env.INTEGRATION)('spend (integration)', () => { beforeAll(async () => { await waitForNode() @@ -14,7 +17,7 @@ describe.skipIf(!process.env.INTEGRATION)('spend (integration)', () => { await connect(config, { connector }) const result = await spend(config, { - recipient: 'ak_2mwRmUeYmfuW93ti9HMSUJzCk1EYcQEfikVSzgo6k2VghsWhgU', + recipient: RECIPIENT, amount: '1000000000000000000', }) diff --git a/test/setup/integration.ts b/test/setup/integration.ts index e00231e..9ec79cc 100644 --- a/test/setup/integration.ts +++ b/test/setup/integration.ts @@ -6,13 +6,14 @@ export const devnet: Network = { id: 'ae_devnet', name: 'Local Devnet', nodeUrl: 'http://localhost:3013', - networkId: 'ae_devnet', } +// Genesis-funded account — pre-funded in test/config/aeternity.yaml genesis_accounts. +// Same account used by aepp-sdk-js integration tests. export const FAUCET_SECRET_KEY = - 'e6a91d633c77cf5771329d3571e1b97e4b6a8da1f92dec562e713ca30fba722c0fc9aa4e782fbd71af7de0a7b40ced95e03b73cb57d0fcf06a54c75ce36f01f02' + 'sk_2CuofqWZHrABCrM7GY95YSQn8PyFvKQadnvFnpwhjUnDCFAWmf' export const FAUCET_PUBLIC_KEY = - 'ak_2mwRmUeYmfuW93ti9HMSUJzCk1EYcQEfikVSzgo6k2VghsWhgU' + 'ak_2CuofqWZHrABCrM7GY95YSQn8PyFvKQadnvFnpwhjUnDCFAWmf' export function createTestConfig() { return createConfig({