Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/actions/retry-command/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Retry Command"
description: "Runs a shell command with retry and timeout support"
inputs:
command:
description: "Shell command to run"
required: true
timeout_seconds:
description: "Maximum number of seconds to allow each attempt"
required: true
retry_wait_seconds:
description: "Number of seconds to wait before retrying"
required: true
max_attempts:
description: "Maximum number of attempts before failing"
required: true
runs:
using: "composite"
steps:
- shell: bash
env:
COMMAND: ${{ inputs.command }}
TIMEOUT_SECONDS: ${{ inputs.timeout_seconds }}
RETRY_WAIT_SECONDS: ${{ inputs.retry_wait_seconds }}
MAX_ATTEMPTS: ${{ inputs.max_attempts }}
run: |
set -euo pipefail

attempt=1

while [ "${attempt}" -le "${MAX_ATTEMPTS}" ]; do
set +e
timeout "${TIMEOUT_SECONDS}" bash -eo pipefail -c "${COMMAND}"
exit_code=$?
set -e

if [ "${exit_code}" -eq 0 ]; then
exit 0
fi

if [ "${attempt}" -eq "${MAX_ATTEMPTS}" ]; then
echo "Command failed after ${MAX_ATTEMPTS} attempts."
exit "${exit_code}"
fi

if [ "${exit_code}" -eq 124 ]; then
echo "Command timed out after ${TIMEOUT_SECONDS} seconds."
else
echo "Command failed with exit code ${exit_code}."
fi

echo "Retrying in ${RETRY_WAIT_SECONDS} seconds..."
sleep "${RETRY_WAIT_SECONDS}"
attempt=$((attempt + 1))
done
16 changes: 7 additions & 9 deletions .github/actions/setup-solana/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ description: "Setup Solana"
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v5
name: Cache Solana Tool Suite
id: cache-solana
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }}
- uses: nick-fields/retry@v2
if: steps.cache-solana.outputs.cache-hit != 'true'
- uses: ./.github/actions/retry-command/
with:
retry_wait_seconds: 300
timeout_minutes: 2
max_attempts: 10
retry_on: error
shell: bash
command: sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)"
command: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)"
timeout_seconds: 60
retry_wait_seconds: 10
max_attempts: 5
- run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash
- run: solana-keygen new --no-bip39-passphrase
Expand Down
20 changes: 7 additions & 13 deletions .github/actions/setup-surfpool/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Installs and caches the Surfpool CLI"
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v5
name: Cache Surfpool Binary
id: cache-surfpool
with:
Expand All @@ -13,21 +13,15 @@ runs:
# Issue: https://github.com/solana-foundation/anchor/issues/4160
key: surfpool-${{ runner.os }}-v${{ env.SURFPOOL_CLI_VERSION }}

- uses: nick-fields/retry@v2
if: steps.cache-surfpool.outputs.cache-hit != 'true'
- uses: ./.github/actions/retry-command/
with:
retry_wait_seconds: 300
timeout_minutes: 2
max_attempts: 10
retry_on: error
shell: bash
command: |
set -euxo pipefail
echo "Installing Surfpool version ${{ env.SURFPOOL_CLI_VERSION }}"
curl -sL https://run.surfpool.run/ | VERSION=v${{ env.SURFPOOL_CLI_VERSION }} bash
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$PATH"
ls -al $HOME/.local/bin



ls -al "$HOME/.local/bin"
timeout_seconds: 60
retry_wait_seconds: 10
max_attempts: 5
6 changes: 3 additions & 3 deletions .github/actions/setup-ts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ description: "Setup ts"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v3
- uses: actions/cache@v5
name: Cache Typescript node_modules
id: cache-typescript-node-modules
with:
path: |
./ts/node_modules/
key: solana-${{ runner.os }}-v0000-${{ env.NODE_VERSION }}-${{ hashFiles('./ts/**/yarn.lock') }}
- uses: actions/cache@v3
- uses: actions/cache@v5
name: Cache Typescript Dist
id: cache-typescript-dist
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/global-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
# Pinned version of the v7.2.0 tag, which is a lightweight and hence mutable tag
- uses: streetsidesoftware/cspell-action@dcd03dc3e8a59ec2e360d0c62db517baa0b4bb6d
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no-unpinned-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
uses: actions/checkout@v6
- run: chmod 755 ./docker/check-docker-pin.sh
- run: ./docker/check-docker-pin.sh
Loading
Loading