forked from AnnabelJoe/solarproof
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (81 loc) · 3.33 KB
/
testnet.yml
File metadata and controls
95 lines (81 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Testnet Integration
on:
pull_request:
branches: [main, develop]
paths:
- 'apps/contracts/**'
- '.github/workflows/testnet.yml'
concurrency:
group: testnet-${{ github.ref }}
cancel-in-progress: true
jobs:
testnet:
name: Deploy & test on Stellar testnet
runs-on: ubuntu-latest
environment: testnet
env:
DEPLOYER_SECRET_KEY: ${{ secrets.DEPLOYER_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
workspaces: apps/contracts
- name: Install Stellar CLI
run: cargo install --locked stellar-cli --features opt
- name: Build contracts
run: stellar contract build
working-directory: apps/contracts
- name: Fund deployer account on testnet
run: |
DEPLOYER_PUB=$(stellar keys address --secret-key "$DEPLOYER_SECRET_KEY" 2>/dev/null || \
stellar keys generate --network testnet ci-deployer --fund && stellar keys address ci-deployer)
curl -s "https://friendbot.stellar.org?addr=${DEPLOYER_PUB}" > /dev/null
echo "DEPLOYER_PUB=${DEPLOYER_PUB}" >> "$GITHUB_ENV"
- name: Deploy energy_token
id: deploy_energy_token
run: |
ID=$(stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/energy_token.wasm \
--source "$DEPLOYER_SECRET_KEY" \
--network testnet)
echo "ENERGY_TOKEN_ID=${ID}" >> "$GITHUB_ENV"
echo "id=${ID}" >> "$GITHUB_OUTPUT"
working-directory: apps/contracts
- name: Deploy audit_registry
id: deploy_audit_registry
run: |
ID=$(stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/audit_registry.wasm \
--source "$DEPLOYER_SECRET_KEY" \
--network testnet)
echo "AUDIT_REGISTRY_ID=${ID}" >> "$GITHUB_ENV"
echo "id=${ID}" >> "$GITHUB_OUTPUT"
working-directory: apps/contracts
- name: Deploy community_governance
id: deploy_community_governance
run: |
ID=$(stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/community_governance.wasm \
--source "$DEPLOYER_SECRET_KEY" \
--network testnet)
echo "COMMUNITY_GOVERNANCE_ID=${ID}" >> "$GITHUB_ENV"
echo "id=${ID}" >> "$GITHUB_OUTPUT"
working-directory: apps/contracts
- name: Run integration tests against deployed contracts
run: cargo test --all -- --include-ignored
working-directory: apps/contracts
env:
STELLAR_NETWORK: testnet
ENERGY_TOKEN_ID: ${{ env.ENERGY_TOKEN_ID }}
AUDIT_REGISTRY_ID: ${{ env.AUDIT_REGISTRY_ID }}
COMMUNITY_GOVERNANCE_ID: ${{ env.COMMUNITY_GOVERNANCE_ID }}
- name: Cleanup — remove deployed contracts (let them expire)
if: always()
run: |
echo "Deployed contract IDs (will expire naturally on testnet):"
echo " energy_token: ${{ steps.deploy_energy_token.outputs.id }}"
echo " audit_registry: ${{ steps.deploy_audit_registry.outputs.id }}"
echo " community_governance: ${{ steps.deploy_community_governance.outputs.id }}"