Audit fixes #499
Workflow file for this run
This file contains hidden or 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: CP-AMM | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - release_* | |
| env: | |
| SOLANA_CLI_VERSION: 2.3.13 | |
| NODE_VERSION: 18.20.6 | |
| ANCHOR_CLI_VERSION: 0.31.0 | |
| TOOLCHAIN: 1.85.0 | |
| jobs: | |
| program_changed_files: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| program: ${{steps.changed-files-specific.outputs.any_changed}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get specific changed files | |
| id: changed-files-specific | |
| uses: tj-actions/changed-files@v18.6 | |
| with: | |
| files: | | |
| programs/cp-amm | |
| rust_sdk_changed_files: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| rust_sdk: ${{steps.changed-files-specific.outputs.any_changed}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get specific changed files | |
| id: changed-files-specific | |
| uses: tj-actions/changed-files@v18.6 | |
| with: | |
| files: | | |
| rust-sdk | |
| anchor_build: | |
| runs-on: ubuntu-latest | |
| needs: program_changed_files | |
| if: needs.program_changed_files.outputs.program == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - uses: ./.github/actions/setup-solana | |
| - uses: ./.github/actions/setup-dep | |
| - uses: ./.github/actions/setup-anchor | |
| # Cache rust, cargo | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-targets: "true" | |
| cache-on-failure: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.anchor | |
| key: anchor-${{ runner.os }}-${{ hashFiles('Anchor.toml') }} | |
| - run: anchor build | |
| shell: bash | |
| rust_sdk_unit_test: | |
| runs-on: ubuntu-latest | |
| needs: [program_changed_files, rust_sdk_changed_files] | |
| if: needs.program_changed_files.outputs.program == 'true' || needs.rust_sdk_changed_files.outputs.rust_sdk == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.TOOLCHAIN }} | |
| components: clippy | |
| # Cache rust, cargo | |
| - uses: Swatinem/rust-cache@v1 | |
| - run: cargo test --package rust-sdk | |
| shell: bash | |
| program_unit_test: | |
| runs-on: ubuntu-latest | |
| needs: program_changed_files | |
| if: needs.program_changed_files.outputs.program == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.TOOLCHAIN }} | |
| components: clippy | |
| # Cache rust, cargo | |
| - uses: Swatinem/rust-cache@v1 | |
| - run: cargo test --package cp-amm | |
| shell: bash | |
| program_integration_test: | |
| runs-on: ubuntu-latest | |
| needs: program_changed_files | |
| if: needs.program_changed_files.outputs.program == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup-solana | |
| - uses: ./.github/actions/setup-dep | |
| - uses: ./.github/actions/setup-anchor | |
| # Install pnpm | |
| - uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions | |
| with: | |
| version: 9.5.0 # Optional: specify a pnpm version | |
| # Install rust + toolchain | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.TOOLCHAIN }} | |
| components: clippy | |
| # Cache rust, cargo | |
| - uses: Swatinem/rust-cache@v1 | |
| # Cache node_modules | |
| - uses: actions/cache@v4 | |
| id: cache-node-modules | |
| with: | |
| path: ./node_modules | |
| key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }} | |
| # Testing | |
| - run: pnpm install | |
| shell: bash | |
| - run: pnpm test | |
| shell: bash |