Skip to content

Commit

Permalink
Merge pull request #193 from silas-x/master
Browse files Browse the repository at this point in the history
CI: Update Rust workflow and add TS workflow
  • Loading branch information
skrrb authored Nov 21, 2023
2 parents b70cac7 + ed159fa commit cc17e92
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 24 deletions.
58 changes: 39 additions & 19 deletions .github/workflows/ci-code-review-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ on:
'programs/**',
'lib/client/**',
'Cargo.lock',
'.github/workflows/ci-code-review-rust.yml',
]
workflow_dispatch: # Pick branch manually

pull_request:
branches: ['master']
paths:
[
'programs/**',
'lib/client/**',
'Cargo.lock',
]

workflow_dispatch:

env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: '1.16.1'
RUST_TOOLCHAIN: '1.70.0'

jobs:
format:
Expand All @@ -21,20 +31,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
run: rustup toolchain install ${{ env.RUST_TOOLCHAIN }} --component rustfmt

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

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Install Rust toolchain
run: rustup toolchain install ${{ env.RUST_TOOLCHAIN }} --component clippy

- name: Run Clippy
run: cargo clippy --features enable-gpl -- --no-deps -D warnings --allow=clippy::result-large-err

test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -48,18 +69,10 @@ jobs:
uses: extractions/setup-just@v1

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
profile: minimal
components: rustc
override: true
default: true
run: rustup toolchain install ${{ env.RUST_TOOLCHAIN }}

- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
env-vars: 'SOLANA_VERSION'

- name: Install Solana
uses: metadaoproject/[email protected]
Expand All @@ -73,3 +86,10 @@ jobs:
- name: Run tests all deps
run: just test-all
shell: bash

all-pass:
name: All tests pass 📖
needs: ['format', 'lint', 'test']
runs-on: ubuntu-latest
steps:
- run: echo ok
83 changes: 83 additions & 0 deletions .github/workflows/ci-code-review-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Code Review - TS

on:
push:
paths:
[
'ts/**',
'yarn.lock'
]
pull_request:
branches: ['master']
paths:
[
'ts/**',
'yarn.lock'
]
workflow_dispatch:

jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Format
run: yarn format

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

sast:
name: Static security scan
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialise CodeQL
uses: github/codeql-action/init@v2
with:
languages: 'javascript'

- name: Run CodeQL
uses: github/codeql-action/analyze@v2

all-pass:
name: All tests pass 📖
needs: ['format', 'lint', 'sast']
runs-on: ubuntu-latest
steps:
- run: echo ok
2 changes: 0 additions & 2 deletions lib/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["workspace-inheritance"]

[package]
edition = "2021"
name = "openbook-v2-client"
Expand Down
4 changes: 1 addition & 3 deletions programs/openbook-v2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["workspace-inheritance"]

[package]
description = "Created with Anchor"
edition = "2021"
Expand Down Expand Up @@ -35,7 +33,7 @@ itertools = "0.10.3"
num_enum = "0.5.1"
pyth-sdk-solana = { workspace = true }
solana-program = { workspace = true }
solana-sdk = { workspace = true, default-features = false, optional = true }
solana-sdk = { workspace = true, optional = true }
static_assertions = "1.1"
switchboard-program = ">=0.2.0"
switchboard-v2 = "0.4.0"
Expand Down

0 comments on commit cc17e92

Please sign in to comment.