From 6a33428759d26e1b497cf01cda97cc23064632e7 Mon Sep 17 00:00:00 2001 From: Ayush Date: Fri, 4 Oct 2024 14:25:43 +0530 Subject: [PATCH] add steel ci --- .github/workflows/steel.yml | 117 ++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .github/workflows/steel.yml diff --git a/.github/workflows/steel.yml b/.github/workflows/steel.yml new file mode 100644 index 00000000..1d3aa8db --- /dev/null +++ b/.github/workflows/steel.yml @@ -0,0 +1,117 @@ +name: Steel + +on: + schedule: + - cron: "0 0 * * *" + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + solana-version: [stable] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + - uses: heyAyushh/setup-solana@v5.4 + with: + solana-cli-version: ${{ matrix.solana-version }} + - run: solana block + shell: bash + - name: Install pnpm + run: | + npm install --global pnpm + - name: Build Native programs + run: | + declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) + echo "Projects to Build:" + printf "%s\n" "${ProjectDirs[@]}" + for projectDir in "${ProjectDirs[@]}"; do + echo " + ******** + Building $projectDir + ********" + cd $projectDir + if pnpm build; then + echo "Build succeeded for $projectDir." + else + failed=true + failed_builds+=($projectDir) + echo "Build failed for $projectDir. Continuing with the next program." + fi + cd - > /dev/null + done + if [ "$failed" = true ]; then + echo "Programs that failed building:" + printf "%s\n" "${failed_builds[@]}" + exit 1 + else + echo "All programs built successfully." + fi + shell: bash + + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + solana-version: [1.18.17, stable] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + check-latest: true + - uses: heyAyushh/setup-solana@v5.4 + with: + solana-cli-version: ${{ matrix.solana-version }} + - run: solana block + shell: bash + - name: Install pnpm + run: | + npm install --global pnpm + - name: Test solana native programs + run: | + solana -V + rustc -V + declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) + echo "Projects to Test:" + printf "%s\n" "${ProjectDirs[@]}" + for projectDir in "${ProjectDirs[@]}"; do + echo " + ******** + Testing $projectDir + ********" + cd $projectDir + pnpm install --frozen-lockfile + if pnpm build-and-test; then + echo "Tests succeeded for $projectDir." + else + failed=true + failed_tests+=($projectDir) + echo "Tests failed for $projectDir. Continuing with the next program." + fi + cd - > /dev/null + done + if [ "$failed" = true ]; then + echo "*****************************" + echo "Programs that failed testing:" + printf "%s\n" "${failed_tests[@]}" + exit 1 + else + echo "All tests passed." + fi + shell: bash