create-axiom-client periodic test #4134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "create-axiom-client periodic test" | |
on: | |
schedule: | |
# Runs on the 18th minute of every hour (reduce scheduling conflicts) | |
- cron: "18 * * * *" | |
env: | |
RPC_URL_11155111: ${{ secrets.RPC_URL_11155111 }} | |
jobs: | |
create-axiom-client-periodic-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Corepack enable | |
run: corepack enable | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: pnpm setup | |
run: SHELL=bash pnpm setup | |
- name: Source bashrc | |
run: source /home/runner/.bashrc | |
- name: Set Git user | |
run: | | |
git config --global user.name "Axiom CI" | |
git config --global user.email "[email protected]" | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Check forge version | |
run: forge --version | |
- name: Determine scaffold based on hour | |
id: scaffold | |
run: | | |
HOUR=$(date +'%-H') | |
SCAFFOLD=$((HOUR % 3)) | |
if [ "$SCAFFOLD" -eq 0 ]; then | |
SCAFFOLD="nextjs" | |
elif [ "$SCAFFOLD" -eq 1 ]; then | |
SCAFFOLD="script" | |
else | |
SCAFFOLD="forge" | |
fi | |
echo "SCAFFOLD=$SCAFFOLD" >> $GITHUB_ENV | |
- name: Determine package manager in 45 mins intervals | |
id: package_manager | |
run: | | |
EPOCH_TIME=$(date +%s) | |
INTERVALS=$((EPOCH_TIME / 2700)) # 2700 seconds = 45 minutes | |
INDEX=$((INTERVALS % 3)) | |
PACKAGE_MANAGERS=("npm" "yarn" "pnpm") | |
PKG=${PACKAGE_MANAGERS[$INDEX]} | |
echo "PKG=$PKG" >> $GITHUB_ENV | |
- name: create-axiom-client | |
run: | | |
export PNPM_HOME="/home/runner/.local/share/pnpm" | |
export PATH="$PNPM_HOME:$PATH" | |
npm_config_yes=true npx create-axiom-client init -p axiom-app -s ${{ env.SCAFFOLD }} -m ${{ env.PKG }} -c 11155111 | |
- name: Write local .env file | |
working-directory: ./axiom-app | |
run: | | |
echo "RPC_URL_11155111=${{ env.RPC_URL_11155111 }}" > .env | |
echo "PROVIDER_URI_11155111=${{ env.RPC_URL_11155111 }}" >> .env | |
- name: Run Forge Test | |
working-directory: ./axiom-app | |
run: forge test |