|
| 1 | +name: Steel |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 * * *" |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + pull_request: |
| 10 | + types: [opened, synchronize, reopened] |
| 11 | + branches: |
| 12 | + - main |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + node-version: [20.x] |
| 20 | + solana-version: [stable] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: Use Node.js ${{ matrix.node-version }} |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: ${{ matrix.node-version }} |
| 27 | + check-latest: true |
| 28 | + - uses: heyAyushh/setup-solana@v5.4 |
| 29 | + with: |
| 30 | + solana-cli-version: ${{ matrix.solana-version }} |
| 31 | + - run: solana block |
| 32 | + shell: bash |
| 33 | + - name: Install pnpm |
| 34 | + run: | |
| 35 | + npm install --global pnpm |
| 36 | + - name: Build Steel native programs |
| 37 | + run: | |
| 38 | + declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) |
| 39 | + echo "Projects to Build:" |
| 40 | + printf "%s\n" "${ProjectDirs[@]}" |
| 41 | + for projectDir in "${ProjectDirs[@]}"; do |
| 42 | + echo " |
| 43 | + ******** |
| 44 | + Building $projectDir |
| 45 | + ********" |
| 46 | + cd $projectDir |
| 47 | + if pnpm build; then |
| 48 | + echo "Build succeeded for $projectDir." |
| 49 | + else |
| 50 | + failed=true |
| 51 | + failed_builds+=($projectDir) |
| 52 | + echo "Build failed for $projectDir. Continuing with the next program." |
| 53 | + fi |
| 54 | + cd - > /dev/null |
| 55 | + done |
| 56 | + if [ "$failed" = true ]; then |
| 57 | + echo "Programs that failed building:" |
| 58 | + printf "%s\n" "${failed_builds[@]}" |
| 59 | + exit 1 |
| 60 | + else |
| 61 | + echo "All programs built successfully." |
| 62 | + fi |
| 63 | + shell: bash |
| 64 | + |
| 65 | + test: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + strategy: |
| 68 | + matrix: |
| 69 | + node-version: [20.x] |
| 70 | + solana-version: [1.18.17, stable] |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + - name: Use Node.js ${{ matrix.node-version }} |
| 74 | + uses: actions/setup-node@v4 |
| 75 | + with: |
| 76 | + node-version: ${{ matrix.node-version }} |
| 77 | + check-latest: true |
| 78 | + - uses: heyAyushh/setup-solana@v5.4 |
| 79 | + with: |
| 80 | + solana-cli-version: ${{ matrix.solana-version }} |
| 81 | + - run: solana block |
| 82 | + shell: bash |
| 83 | + - name: Install pnpm |
| 84 | + run: | |
| 85 | + npm install --global pnpm |
| 86 | + - name: Test Steel native programs |
| 87 | + run: | |
| 88 | + solana -V |
| 89 | + rustc -V |
| 90 | + declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) |
| 91 | + echo "Projects to Test:" |
| 92 | + printf "%s\n" "${ProjectDirs[@]}" |
| 93 | + for projectDir in "${ProjectDirs[@]}"; do |
| 94 | + echo " |
| 95 | + ******** |
| 96 | + Testing $projectDir |
| 97 | + ********" |
| 98 | + cd $projectDir |
| 99 | + pnpm install --frozen-lockfile |
| 100 | + if pnpm build-and-test; then |
| 101 | + echo "Tests succeeded for $projectDir." |
| 102 | + else |
| 103 | + failed=true |
| 104 | + failed_tests+=($projectDir) |
| 105 | + echo "Tests failed for $projectDir. Continuing with the next program." |
| 106 | + fi |
| 107 | + cd - > /dev/null |
| 108 | + done |
| 109 | + if [ "$failed" = true ]; then |
| 110 | + echo "*****************************" |
| 111 | + echo "Programs that failed testing:" |
| 112 | + printf "%s\n" "${failed_tests[@]}" |
| 113 | + exit 1 |
| 114 | + else |
| 115 | + echo "All tests passed." |
| 116 | + fi |
| 117 | + shell: bash |
0 commit comments