Create snapshot of stats #868
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 snapshot of stats" | |
on: | |
schedule: | |
- cron: "30 11 * * *" | |
workflow_dispatch: | |
env: | |
solana_version: 1.14.13 | |
jobs: | |
svm-snap: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: install global mocha | |
run: | | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
npm install -g mocha | |
npm install -g ts-mocha | |
npm install -g typescript | |
npm install -g @project-serum/anchor | |
ts-mocha -h | |
- name: install essential | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config build-essential libudev-dev | |
- name: install solana | |
run: | | |
sh -c "$(curl -sSfL https://release.solana.com/v${{ env.solana_version }}/install)" | |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
solana --version | |
- name: setup solana | |
run: | | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
solana --version | |
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent | |
- name: svm snapshot | |
working-directory: ./svm | |
run: | | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
export ANCHOR_WALLET="/home/runner/.config/solana/id.json" | |
npm install | |
npm run snap | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: svm-snapshot-${{ github.run_id }} | |
path: | | |
./data/*.json | |
./data/eclipse/ | |
./data/ticks/ | |
a0-snap: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: install global mocha | |
run: | | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
npm install -g mocha | |
npm install -g ts-mocha | |
npm install -g typescript | |
ts-mocha -h | |
- name: install essential | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config build-essential libudev-dev | |
- name: a0 snapshot | |
working-directory: ./a0 | |
run: | | |
npm install | |
npm run snap | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: a0-snapshot-${{ github.run_id }} | |
path: | | |
./data/a0/ | |
alph-snap: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: alph snapshot | |
working-directory: ./alph | |
run: | | |
npm install | |
npm run snap | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: alph-snapshot-${{ github.run_id }} | |
path: | | |
./data/alph/ | |
vara-snap: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: vara snapshot | |
working-directory: ./vara | |
run: | | |
npm install | |
npm run snap | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: vara-snapshot-${{ github.run_id }} | |
path: | | |
./data/vara/ | |
deploy: | |
needs: [a0-snap, alph-snap, svm-snap, vara-snap] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download a0 snapshot | |
uses: actions/download-artifact@v4 | |
with: | |
name: a0-snapshot-${{ github.run_id }} | |
path: ./data/a0/ | |
continue-on-error: true | |
- name: Download alph snapshot | |
uses: actions/download-artifact@v4 | |
with: | |
name: alph-snapshot-${{ github.run_id }} | |
path: ./data/alph/ | |
continue-on-error: true | |
- name: Download svm snapshot | |
uses: actions/download-artifact@v4 | |
with: | |
name: svm-snapshot-${{ github.run_id }} | |
path: ./data/ | |
continue-on-error: true | |
- name: Download vara snapshot | |
uses: actions/download-artifact@v4 | |
with: | |
name: vara-snapshot-${{ github.run_id }} | |
path: ./data/vara/ | |
continue-on-error: true | |
- name: Commit changes | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name invariantStats | |
git add ./data/ | |
git commit -m "Snapshot of data done!" | |
- name: GitHub Push | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Deploy to Production | |
uses: amondnet/vercel-action@v20 | |
id: deploy-vercel-production | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
vercel-args: "--prod" | |
scope: ${{ secrets.VERCEL_ORG_ID }} |