Solana deployment scripts and module configs #26
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: Cross-chain Solana | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
branches: | |
- main | |
paths: | |
- "cross-chain/solana/**" | |
- ".github/workflows/cross-chain-solana.yml" | |
pull_request: | |
jobs: | |
contracts-detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
path-filter: ${{ steps.filter.outputs.path-filter }} | |
steps: | |
- uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request' | |
- uses: dorny/paths-filter@v2 | |
if: github.event_name == 'pull_request' | |
id: filter | |
with: | |
filters: | | |
path-filter: | |
- './cross-chain/solana/**' | |
- './.github/workflows/cross-chain-solana.yml' | |
contracts-build-and-test: | |
needs: contracts-detect-changes | |
if: | | |
github.event_name != 'pull_request' | |
|| needs.contracts-detect-changes.outputs.path-filter == 'true' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./cross-chain/solana | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
cache: "yarn" | |
cache-dependency-path: cross-chain/solana/yarn.lock | |
# A workaround for transitive dependencies that use the obsolete git:// | |
# prefix instead of the recommended https:// | |
- name: Configure git to not use unauthenticated protocol | |
run: git config --global url."https://".insteadOf git:// | |
- name: Install Solana | |
run: | | |
sh -c "$(curl -sSfL https://release.solana.com/v1.16.5/install)" | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
- name: Install Rust | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
- name: Install Anchor | |
run: | | |
cargo install --git https://github.com/coral-xyz/anchor --tag v0.28.0 anchor-cli --locked | |
- name: Install dependencies | |
run: yarn install | |
- name: Anchor build | |
run: yarn build | |
# There is problem with a `solana-keygen new` command. The workaround is to create a keyfile manually just for testing purposes. | |
- name: Run tests | |
run: | | |
solana config set -u localhost | |
echo "[132,196,51,204,234,79,135,213,169,81,250,90,73,168,28,41,193,49,153,71,192,44,228,74,230,78,211,95,54,241,137,50,119,155,54,147,229,137,197,57,146,111,140,177,222,54,120,254,254,250,191,135,251,47,163,16,180,160,110,108,54,111,84,76]" >> ~/.config/solana/id.json | |
yarn test | |
contracts-format: | |
needs: contracts-detect-changes | |
if: | | |
github.event_name == 'push' | |
|| needs.contracts-detect-changes.outputs.path-filter == 'true' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./cross-chain/solana | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
cache: "yarn" | |
cache-dependency-path: cross-chain/solana/yarn.lock | |
# A workaround for transitive dependencies that use the obsolete git:// | |
# prefix instead of the recommended https:// | |
- name: Configure git to not use unauthenticated protocol | |
run: git config --global url."https://".insteadOf git:// | |
- name: Install dependencies | |
run: yarn install | |
- name: Check formatting | |
run: yarn format |