Merge pull request #83 from XLabs/deployment/set-canonical-peer-addendum #169
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: Run tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
solana-tests: | |
name: Run Solana SDK tests | |
runs-on: ubuntu-latest | |
env: | |
NODE_OPTIONS: "--max-old-space-size=2500" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17.0" | |
registry-url: "https://npm.pkg.github.com" | |
cache: "yarn" | |
cache-dependency-path: | | |
./yarn.lock | |
- name: Read relayer-infra-contracts commit hash | |
id: relayer-infra-contracts-commit | |
shell: bash | |
run: | | |
submodule_status=$(git submodule status --cached | grep relayer-infra-contracts) | |
# we discard the first character which represents working tree summary diff | |
echo "commit=${submodule_status:1:40}" >> $GITHUB_OUTPUT | |
- name: Checkout relayer-infra-contracts | |
uses: actions/checkout@v4 | |
with: | |
repository: xlabs/relayer-infra-contracts | |
path: lib/relayer-infra-contracts | |
ssh-key: '${{ secrets.RELAYER_INFRA_CONTRACTS }}' | |
ref: ${{ steps.relayer-infra-contracts-commit.outputs.commit }} | |
# Taken from https://github.com/metaDAOproject/setup-anchor/blob/main/action.yml#L25-L40 | |
- name: Cache Solana CLI tools | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-cli-${{ runner.os }}-build-1.28.23 | |
- name: Install Solana CLI tools | |
run: sh -c "$(curl -sSfL https://release.anza.xyz/v1.18.23/install)" | |
shell: bash | |
- name: Update PATH | |
run: echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Install Anchor | |
run: npm i -g @coral-xyz/anchor-cli@0.30.1 | |
shell: bash | |
- name: Create keypair | |
run: solana-keygen new --no-bip39-passphrase | |
shell: bash | |
- name: Setup private package access | |
run: | | |
yarn config set npmScopes.xlabs.npmAlwaysAuth true | |
yarn config set npmScopes.xlabs.npmAuthToken ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: yarn install --immutable --immutable-cache | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Solana programs | |
run: anchor build | |
working-directory: ./solana | |
shell: bash | |
- name: Run Solana SDK tests | |
run: | | |
yarn ./sdk/common build:ts && yarn ./sdk/solana build:ts && yarn ./solana build:ts | |
anchor run setup-test | |
anchor test | |
shell: bash |