|
| 1 | +name: Tron Smart Contracts Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - 'packages/smart-contracts/tron/**' |
| 9 | + - 'packages/smart-contracts/tronbox-config.js' |
| 10 | + - '.github/workflows/tron-smart-contracts.yml' |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + paths: |
| 15 | + - 'packages/smart-contracts/tron/**' |
| 16 | + - 'packages/smart-contracts/tronbox-config.js' |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +jobs: |
| 20 | + tron-tests: |
| 21 | + name: Tron Contract Tests |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + services: |
| 25 | + tron: |
| 26 | + image: tronbox/tre |
| 27 | + ports: |
| 28 | + - 9090:9090 |
| 29 | + options: >- |
| 30 | + --health-cmd "curl -f http://localhost:9090 || exit 1" |
| 31 | + --health-interval 10s |
| 32 | + --health-timeout 5s |
| 33 | + --health-retries 10 |
| 34 | + --health-start-period 30s |
| 35 | +
|
| 36 | + steps: |
| 37 | + - name: Checkout repository |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Setup Node.js |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: '22' |
| 44 | + cache: 'yarn' |
| 45 | + |
| 46 | + - name: Install TronBox globally |
| 47 | + run: npm install -g tronbox |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: yarn install --frozen-lockfile |
| 51 | + |
| 52 | + - name: Wait for Tron node to be ready |
| 53 | + run: | |
| 54 | + echo "Waiting for Tron node..." |
| 55 | + for i in {1..30}; do |
| 56 | + if curl -s http://localhost:9090 > /dev/null 2>&1; then |
| 57 | + echo "Tron node is ready!" |
| 58 | + break |
| 59 | + fi |
| 60 | + echo "Attempt $i/30 - Tron node not ready yet..." |
| 61 | + sleep 5 |
| 62 | + done |
| 63 | +
|
| 64 | + - name: Compile Tron contracts |
| 65 | + working-directory: packages/smart-contracts |
| 66 | + run: yarn tron:compile |
| 67 | + |
| 68 | + - name: Run Tron tests |
| 69 | + working-directory: packages/smart-contracts |
| 70 | + run: yarn tron:test |
| 71 | + env: |
| 72 | + CI: true |
| 73 | + |
| 74 | + - name: Upload test artifacts |
| 75 | + if: failure() |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: tron-test-logs |
| 79 | + path: | |
| 80 | + packages/smart-contracts/tron-build/ |
| 81 | + retention-days: 7 |
| 82 | + |
| 83 | + tron-compile-check: |
| 84 | + name: Tron Contract Compilation Check |
| 85 | + runs-on: ubuntu-latest |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout repository |
| 89 | + uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Setup Node.js |
| 92 | + uses: actions/setup-node@v4 |
| 93 | + with: |
| 94 | + node-version: '22' |
| 95 | + cache: 'yarn' |
| 96 | + |
| 97 | + - name: Install TronBox globally |
| 98 | + run: npm install -g tronbox |
| 99 | + |
| 100 | + - name: Install dependencies |
| 101 | + run: yarn install --frozen-lockfile |
| 102 | + |
| 103 | + - name: Compile Tron contracts |
| 104 | + working-directory: packages/smart-contracts |
| 105 | + run: yarn tron:compile |
| 106 | + |
| 107 | + - name: Verify build artifacts exist |
| 108 | + working-directory: packages/smart-contracts |
| 109 | + run: | |
| 110 | + echo "Checking build artifacts..." |
| 111 | + ls -la tron-build/ |
| 112 | +
|
| 113 | + # Verify key contracts were compiled |
| 114 | + if [ ! -f "tron-build/ERC20FeeProxy.json" ]; then |
| 115 | + echo "ERROR: ERC20FeeProxy.json not found!" |
| 116 | + exit 1 |
| 117 | + fi |
| 118 | +
|
| 119 | + if [ ! -f "tron-build/TestTRC20.json" ]; then |
| 120 | + echo "ERROR: TestTRC20.json not found!" |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | +
|
| 124 | + echo "✅ All required artifacts present" |
0 commit comments