Skip to content

Commit de8d6e0

Browse files
committed
Add GitHub Actions workflow for building Scrypto package
1 parent f79dd74 commit de8d6e0

2 files changed

Lines changed: 238 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build Scrypto Package
2+
3+
on:
4+
workflow_dispatch: # Allows manual trigger from GitHub UI
5+
push:
6+
paths:
7+
- 'Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/**'
8+
pull_request:
9+
paths:
10+
- 'Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/**'
11+
12+
jobs:
13+
build:
14+
name: Build OASIS Storage Scrypto Package
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Install Rust
22+
uses: dtolnay/rust-toolchain@stable
23+
with:
24+
targets: wasm32-unknown-unknown
25+
26+
- name: Cache Cargo dependencies
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
~/.cargo/bin/
31+
~/.cargo/registry/index/
32+
~/.cargo/registry/cache/
33+
~/.cargo/git/db/
34+
Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/target/
35+
key: ${{ runner.os }}-scrypto-${{ hashFiles('Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/Cargo.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-scrypto-
38+
39+
- name: Install Scrypto CLI tools
40+
run: |
41+
cargo install radix-clis --locked
42+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
43+
44+
- name: Verify Scrypto installation
45+
run: scrypto --version
46+
47+
- name: Build Scrypto package
48+
working-directory: Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts
49+
run: scrypto build
50+
51+
- name: Verify WASM file exists
52+
working-directory: Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts
53+
run: |
54+
if [ -f "target/wasm32-unknown-unknown/release/oasis_storage.wasm" ]; then
55+
echo "✅ WASM file built successfully"
56+
ls -lh target/wasm32-unknown-unknown/release/oasis_storage.wasm
57+
else
58+
echo "❌ WASM file not found!"
59+
exit 1
60+
fi
61+
62+
- name: Upload WASM artifact
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: oasis-storage-wasm
66+
path: Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/target/wasm32-unknown-unknown/release/oasis_storage.wasm
67+
retention-days: 30
68+
69+
- name: Build summary
70+
run: |
71+
echo "## ✅ Build Successful" >> $GITHUB_STEP_SUMMARY
72+
echo "" >> $GITHUB_STEP_SUMMARY
73+
echo "The WASM file has been built and uploaded as an artifact." >> $GITHUB_STEP_SUMMARY
74+
echo "" >> $GITHUB_STEP_SUMMARY
75+
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
76+
echo "1. Download the artifact from the workflow run" >> $GITHUB_STEP_SUMMARY
77+
echo "2. Deploy via Radix Wallet Developer Console: https://console.radixdlt.com/deploy-package" >> $GITHUB_STEP_SUMMARY
78+
echo "3. Get component address and update OASIS_DNA.json" >> $GITHUB_STEP_SUMMARY
79+
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# GitHub Actions Build Guide
2+
3+
## Overview
4+
5+
This guide explains how to use GitHub Actions to build the Scrypto package and get the WASM file for deployment.
6+
7+
## Quick Start
8+
9+
### Step 1: Push Code to GitHub
10+
11+
If you haven't already, commit and push your code to GitHub:
12+
13+
```bash
14+
cd /Volumes/Storage/OASIS_CLEAN
15+
16+
# Add the workflow file
17+
git add .github/workflows/build-scrypto.yml
18+
19+
# Commit
20+
git commit -m "Add GitHub Actions workflow for building Scrypto package"
21+
22+
# Push to GitHub
23+
git push origin <your-branch>
24+
```
25+
26+
### Step 2: Trigger the Workflow
27+
28+
The workflow can be triggered in two ways:
29+
30+
#### Option A: Manual Trigger (Recommended for first time)
31+
32+
1. Go to your GitHub repository
33+
2. Click on **Actions** tab
34+
3. Select **Build Scrypto Package** workflow
35+
4. Click **Run workflow** button (top right)
36+
5. Select your branch
37+
6. Click **Run workflow**
38+
39+
#### Option B: Automatic Trigger
40+
41+
The workflow will automatically run when:
42+
- You push changes to files in `Providers/Blockchain/NextGenSoftware.OASIS.API.Providers.RadixOASIS/contracts/**`
43+
- You open a pull request that modifies contract files
44+
45+
### Step 3: Monitor the Build
46+
47+
1. Click on the running workflow to see progress
48+
2. Wait for all steps to complete (usually 5-15 minutes)
49+
3. Check that the build succeeded (green checkmark)
50+
51+
### Step 4: Download the WASM File
52+
53+
1. After the workflow completes successfully, scroll to the bottom
54+
2. Find the **Artifacts** section
55+
3. Click on **oasis-storage-wasm** artifact
56+
4. Download the file
57+
58+
The downloaded file will be named `oasis_storage.wasm` - this is your compiled package!
59+
60+
### Step 5: Deploy to Radix
61+
62+
Now you can deploy using the Radix Wallet Developer Console:
63+
64+
1. **Go to Developer Console**: https://console.radixdlt.com/deploy-package
65+
2. **Connect your Radix Wallet**
66+
3. **Upload the WASM file** you just downloaded
67+
4. **Get package address** from the transaction receipt
68+
5. **Instantiate component** to get component address
69+
6. **Update OASIS_DNA.json** with the component address
70+
71+
See `STEP_BY_STEP_WALLET_DEPLOYMENT.md` for detailed deployment instructions.
72+
73+
---
74+
75+
## Workflow Details
76+
77+
### What the Workflow Does
78+
79+
1. **Checkout code**: Gets your repository code
80+
2. **Install Rust**: Sets up Rust toolchain with WASM target
81+
3. **Cache dependencies**: Speeds up subsequent builds
82+
4. **Install Scrypto CLI**: Installs radix-clis tools
83+
5. **Build package**: Runs `scrypto build`
84+
6. **Verify WASM file**: Checks that the file was created
85+
7. **Upload artifact**: Makes the WASM file downloadable
86+
87+
### Build Time
88+
89+
- First run: ~10-15 minutes (installs dependencies)
90+
- Subsequent runs: ~5-10 minutes (uses cached dependencies)
91+
92+
### Artifact Retention
93+
94+
The WASM artifact is retained for **30 days** after the workflow run.
95+
96+
---
97+
98+
## Troubleshooting
99+
100+
### Workflow Fails to Start
101+
102+
**Issue**: Workflow doesn't appear in Actions tab
103+
**Solution**:
104+
- Ensure `.github/workflows/build-scrypto.yml` is in your repository
105+
- Make sure it's pushed to GitHub
106+
- Check that the YAML syntax is valid
107+
108+
### Build Fails
109+
110+
**Issue**: Build step fails with errors
111+
**Solution**:
112+
- Check the workflow logs for specific error messages
113+
- Ensure Cargo.toml is valid
114+
- Verify all dependencies are available on crates.io
115+
116+
### Artifact Not Found
117+
118+
**Issue**: Can't download artifact after build completes
119+
**Solution**:
120+
- Make sure the build succeeded (green checkmark)
121+
- Check that the artifact upload step completed
122+
- Artifacts are only available for successful workflow runs
123+
124+
### Slow Build Times
125+
126+
**Issue**: Build takes too long
127+
**Solution**:
128+
- First build is always slower (installing dependencies)
129+
- Subsequent builds use cache and are faster
130+
- Consider using a self-hosted runner if needed
131+
132+
---
133+
134+
## Re-building
135+
136+
To rebuild the package:
137+
138+
1. **Option 1**: Manually trigger the workflow (Actions → Build Scrypto Package → Run workflow)
139+
2. **Option 2**: Make a change to any file in `contracts/` directory and push
140+
3. **Option 3**: Open a pull request with contract changes
141+
142+
---
143+
144+
## Next Steps After Getting WASM
145+
146+
1. ✅ Download WASM file from GitHub Actions artifact
147+
2. ⏳ Deploy to Stokenet via Developer Console
148+
3. ⏳ Get component address
149+
4. ⏳ Update OASIS_DNA.json
150+
5. ⏳ Test the integration
151+
152+
---
153+
154+
## Additional Resources
155+
156+
- GitHub Actions Documentation: https://docs.github.com/en/actions
157+
- Radix Developer Console: https://console.radixdlt.com/
158+
- Scrypto Documentation: https://docs.radixdlt.com/docs/scrypto-1
159+

0 commit comments

Comments
 (0)