From 9642afee2037fd0024f70b4312ad36e5ce076b77 Mon Sep 17 00:00:00 2001 From: Conner Gallagher Date: Thu, 15 Dec 2022 18:40:20 -0700 Subject: [PATCH] simplified gh actions --- .github/actions/anchor-build/action.yaml | 12 ------ .github/actions/build-program/action.yml | 35 --------------- .github/actions/install-anchor/action.yml | 22 ---------- .../install-common-build-deps/action.yml | 43 ------------------- .../install-linux-build-deps/action.yml | 8 ---- .github/actions/install-rust/action.yml | 37 ---------------- .github/actions/install-solana/action.yml | 32 -------------- .github/actions/verify-rust/action.yml | 21 --------- .github/workflows/solana-js-test.yml | 30 +++++++------ 9 files changed, 16 insertions(+), 224 deletions(-) delete mode 100644 .github/actions/anchor-build/action.yaml delete mode 100644 .github/actions/build-program/action.yml delete mode 100644 .github/actions/install-anchor/action.yml delete mode 100644 .github/actions/install-common-build-deps/action.yml delete mode 100644 .github/actions/install-linux-build-deps/action.yml delete mode 100644 .github/actions/install-rust/action.yml delete mode 100644 .github/actions/install-solana/action.yml delete mode 100644 .github/actions/verify-rust/action.yml diff --git a/.github/actions/anchor-build/action.yaml b/.github/actions/anchor-build/action.yaml deleted file mode 100644 index f576aab..0000000 --- a/.github/actions/anchor-build/action.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Anchor Publish' -description: 'Perform a verifiable build for a Solana program in a given directory' - -runs: - using: 'composite' - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/install-anchor/ - with: - node-version: ${{ env.NODE_VERSION }} - - run: ~/.cargo/bin/anchor build --verifiable - shell: bash diff --git a/.github/actions/build-program/action.yml b/.github/actions/build-program/action.yml deleted file mode 100644 index bf11d58..0000000 --- a/.github/actions/build-program/action.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Implicit dependencies -# - actions/checkout@v3 -# - ./.github/actions/install-linux-build-deps -# - ./.github/actions/install-solana -# - ./.github/actions/install-rust - -name: Build Program -description: Builds the specified Rust program based on the `name` input -inputs: - name: - description: The name of the program to build - required: true -runs: - using: 'composite' - steps: -# - name: "Cache: ${{ inputs.name }}" -# uses: actions/cache@v3 -# with: -# path: | -# ~/.cargo/bin/ -# ~/.cargo/registry/index/ -# ~/.cargo/registry/cache/ -# ~/.cargo/git/db/ -# ./${{ inputs.name }}/program/target/ -# key: -# program-${{ inputs.name }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} -# id: cache-program - - name: "Build: ${{ inputs.name }}" - working-directory: ./${{ inputs.name }}/program - run: | - mkdir -p ../../test-programs - cargo +${{ env.RUST_STABLE }} build-bpf --version - cargo +${{ env.RUST_STABLE }} build-bpf --bpf-out-dir ../../test-programs/ - shell: bash - diff --git a/.github/actions/install-anchor/action.yml b/.github/actions/install-anchor/action.yml deleted file mode 100644 index 047e48d..0000000 --- a/.github/actions/install-anchor/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -# if referencing from a workflow, ANCHOR_VERSION environment variable must be defined -name: Setup Anchor CLI -description: 'Setup Anchor CLI' - -runs: - using: 'composite' - steps: - - uses: actions/cache@v3 - name: Cache Anchor CLI - id: cache-anchor-cli - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ./target/ - key: anchor-cli-${{ runner.os }}-v0000-${{ env.ANCHOR_VERSION }} - - run: - cargo install --git https://github.com/project-serum/anchor --tag "v$ANCHOR_VERSION" anchor-cli --locked - shell: bash - if: steps.cache-anchor-cli.outputs.cache-hit != 'true' diff --git a/.github/actions/install-common-build-deps/action.yml b/.github/actions/install-common-build-deps/action.yml deleted file mode 100644 index 9190bdc..0000000 --- a/.github/actions/install-common-build-deps/action.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Install common build deps -description: Install common build tools - -inputs: - linux: - description: Install or restore Linux dependencies from cache - required: false - default: "true" - rust: - description: Install or restore Rust from cache - required: false - default: "true" - rust-version: - description: Version for Rust, default to stable - required: false - default: "stable" - solana: - description: Install or restore Solana from cache - required: false - default: "true" - anchor: - description: Install or restore Anchor CLI from cache - required: false - default: "true" - -runs: - using: composite - steps: - - uses: ./.github/actions/install-linux-build-deps - if: inputs.linux == 'true' - - - uses: ./.github/actions/install-rust - if: inputs.rust == 'true' - with: - toolchain: ${{ inputs.rust-version }} - - - uses: ./.github/actions/install-solana - if: inputs.solana == 'true' - with: - solana_version: ${{ env.SOLANA_VERSION }} - - - uses: ./.github/actions/install-anchor - if: inputs.anchor == 'true' diff --git a/.github/actions/install-linux-build-deps/action.yml b/.github/actions/install-linux-build-deps/action.yml deleted file mode 100644 index 04654fd..0000000 --- a/.github/actions/install-linux-build-deps/action.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Install Linux Build Deps -runs: - using: "composite" - steps: - - run: - sudo apt-get update && sudo apt-get install -y pkg-config - build-essential libudev-dev - shell: bash diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml deleted file mode 100644 index 45274c2..0000000 --- a/.github/actions/install-rust/action.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Install Rust - -inputs: - toolchain: - description: The Rust version to use, default env.RUST_TOOLCHAIN - required: true - -runs: - using: "composite" - steps: - - name: Install Rust Stable - id: rust_toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ inputs.toolchain }} - override: true - profile: minimal - components: rustfmt, clippy - - - name: Add Cargo bin to Path - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - shell: bash - - - name: Verify Rust install - run: | - echo "Verifying rust '${{ inputs.toolchain }}' ..." - rustc --version - cargo --version - cargo clippy --version - rustfmt --version - shell: bash - - - name: Share rustc hash - run: | - echo 'RUSTC_HASH=${{ steps.rust_toolchain.outputs.rustc_hash }}' >> $GITHUB_ENV - shell: bash diff --git a/.github/actions/install-solana/action.yml b/.github/actions/install-solana/action.yml deleted file mode 100644 index 2c55cd1..0000000 --- a/.github/actions/install-solana/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Install Solana - -inputs: - solana_version: - description: Version of Solana to install - required: true - default: 1.10.40 - -runs: - using: "composite" - steps: -# - name: Cache Solana Install -# id: cache-solana-install -# uses: actions/cache@v3 -# with: -# path: | -# ~/.cache/solana/ -# ~/.local/share/solana/ -# key: ${{ runner.os }}-Solana-v${{ inputs.solana_version }} - - - run: sh -c "$(curl -sSfL https://release.solana.com/v${{ inputs.solana_version }}/install)" - shell: bash - - - name: Add Solana bin to Path - run: | - echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH - shell: bash - - - name: Verify Solana install - run: | - solana --version - shell: bash diff --git a/.github/actions/verify-rust/action.yml b/.github/actions/verify-rust/action.yml deleted file mode 100644 index c0d3a59..0000000 --- a/.github/actions/verify-rust/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Verify Rust - -inputs: - working-directory: - description: The program directory you're trying to verify - required: true - -runs: - using: "composite" - steps: - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --manifest-path ${{ inputs.working-directory }}/Cargo.toml -- --check - - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-targets --all-features --no-deps --manifest-path ${{ inputs.working-directory }}/Cargo.toml diff --git a/.github/workflows/solana-js-test.yml b/.github/workflows/solana-js-test.yml index e289fa8..e29fed6 100644 --- a/.github/workflows/solana-js-test.yml +++ b/.github/workflows/solana-js-test.yml @@ -16,20 +16,13 @@ env: SOLANA_VERSION: 1.13.5 jobs: - solana_js_test: + solana_js_devnet_test: runs-on: ubuntu-latest defaults: run: shell: bash steps: - # Setup Deps - uses: actions/checkout@v3 - - name: Setup Linux Build Deps - uses: ./.github/actions/install-linux-build-deps - - name: Install Solana - uses: ./.github/actions/install-solana - with: - solana_version: ${{ env.SOLANA_VERSION }} - name: Use Node.js uses: actions/setup-node@v3 with: @@ -39,10 +32,19 @@ jobs: - name: Build solana.js working-directory: javascript/solana.js run: npm install && npm run build - - name: Start Local Validator & Run Tests + - name: Start Local Validator + uses: switchboard-xyz/solana-local-validator@v1 + with: + solana-version: v1.14.10 + anchor-version: v0.25.2 + cluster: devnet + args: + "--url https://api.devnet.solana.com --clone + 2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG --clone + J4CArpsbrZqu1axqQ4AnrqREs3jwoyA1M5LMiQQmAzB9 --clone + CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp --clone + BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt --clone + FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy" + - name: Run Tests working-directory: javascript/solana.js - run: | - solana-keygen new --no-bip39-passphrase --outfile ~/.config/solana/id.json --silent - mkdir -p .anchor/test-ledger - npm run localnet:up - npm run localnet:down + run: npm run test:localnet