Skip to content

Commit

Permalink
chore: Add CI (#18)
Browse files Browse the repository at this point in the history
* chore: Add CI

* Fix name of the branch

* Fix anchor CI
  • Loading branch information
Aursen authored Feb 21, 2024
1 parent 29a94e5 commit 88bf9bf
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 333 deletions.
21 changes: 0 additions & 21 deletions .github/actions/setup-rust/action.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@ description: "Setup Solana"
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache Solana Tool Suite
id: cache-solana
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }}
- uses: nick-fields/retry@v2
key: solana-${{ runner.os }}-v${{ env.SOLANA_CLI_VERSION }}
- uses: nick-fields/retry@v3
if: steps.cache-solana.outputs.cache-hit != 'true'
with:
retry_wait_seconds: 300
timeout_minutes: 2
max_attempts: 10
retry_on: error
shell: bash
command: sh -c "$(curl -sSfL https://release.solana.com/${{ env.SOLANA_VERSION }}/install)"
- run: sh -c "$(curl -sSfL https://release.solana.com/${{ env.SOLANA_VERSION }}/install)"
command: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)"
- run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash

- run: |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash
- run: solana-install init ${{ env.SOLANA_VERSION }}
- run: solana-keygen new --no-bip39-passphrase
shell: bash
- run: solana config set --url localhost
shell: bash
224 changes: 0 additions & 224 deletions .github/workflows/bump-release.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Lints and Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
SOLANA_CLI_VERSION: 1.18.2
ANCHOR_CLI_VERSION: 0.29.0

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Solana CLI
uses: ./.github/actions/setup-solana/
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup Anchor CLI
run: npm install -g @coral-xyz/anchor-cli@${{ env.ANCHOR_CLI_VERSION }}
- name: Cargo tests
run: cargo test
env:
RUST_BACKTRACE: 1
- name: Anchor tests
run: anchor test
timeout-minutes: 10

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy --all-targets -- -D warnings
Loading

0 comments on commit 88bf9bf

Please sign in to comment.