Persist PATH additions properly #11
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
# From https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs#using-the-nodejs-starter-workflow | |
name: Node.js CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
env: | |
# Program locations are not a secret so don't | |
# worry about including them in this file | |
METAPLEX_TOKEN_METADATA_PROGRAM_ADDRESS: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" | |
# We skip certain network-using tests on GitHub | |
ON_GITHUB: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Solana | |
run: | | |
sh -c "$(curl -sSfL https://release.solana.com/stable/install)" | |
- name: Add Solana bin directory to PATH | |
run: | | |
echo "~/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
- name: Install Rust | |
# https://stackoverflow.com/questions/57251508/run-rustups-curl-fetched-installer-script-non-interactively | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows | |
# "On a cache miss, the action automatically creates a new cache if the job completes successfully." | |
# From Rust example at https://github.com/actions/cache/tree/main | |
- name: Restore Rust dependencies from Cache if possible | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Anchor | |
run: | | |
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force | |
avm install latest | |
avm use latest | |
- name: Add Anchor bin directory to PATH | |
run: | | |
echo "~/.avm/bin" >> $GITHUB_PATH | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Check 'Favorites' program compiles and passes tests | |
run: | | |
cd labs/favorites | |
cd programs/favorites | |
anchor test |