|
| 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