Skip to content

add: caching for validator in CI #42

add: caching for validator in CI

add: caching for validator in CI #42

Workflow file for this run

# From https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs#using-the-nodejs-starter-workflow
name: Node.js and Solana CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
# From https://github.com/solana-labs/solana-web3.js/blob/94b4d494590b2ffbf60751bb74ed267b7228f012/.github/workflows/cicd.yml#L35-L50
- name: Get Test Validator Latest Release
id: get-test-validator-version
run: |
echo "version=$(./scripts/get-latest-validator-release-version.sh)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Test Validator
id: cache-test-validator
uses: actions/cache@v3
with:
path: /home/runner/.local/share/solana
key: ${{ runner.os }}-test-validator-${{ steps.get-test-validator-version.outputs.version }}
- name: Install Test Validator if needed
if: steps.cache-test-validator.outputs.cache-hit != 'true'
run: scripts/setup-test-validator.sh
- name: Add to PATH
shell: bash
run: |
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
# Install everything
- run: npm ci
- name: Check Solana keygen is installed
run: which solana-keygen
# Run tests
- run: npm test