Skip to content

Commit

Permalink
ci: add pristine github workflows (#5)
Browse files Browse the repository at this point in the history
copying workflows from old repo
  • Loading branch information
JayWhite2357 authored Jun 12, 2024
1 parent c5647ba commit 789ab89
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang" # used to decrease build time
rustflags = ["-Clink-arg=-fuse-ld=lld"] # used to decrease link time
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly in the linked Jira ticket then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the ticket here but it is sometimes worth providing a summary of the individual changes in this PR.
-->

# Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
140 changes: 140 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: CI-Lint-And-Test

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
# Run cargo check (with various feature permutations)
check:
name: Check Package
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld
- name: Run cargo check (no features, exclude examples)
run: cargo check --no-default-features
- name: Run cargo check (default features)
run: cargo check --all-targets
- name: Run cargo check (all features)
run: cargo check --all-targets --all-features
- name: Run cargo check (proofs) (no features)
run: cargo check -p proofs --no-default-features
- name: Run cargo check (proofs) (all features)
run: cargo check -p proofs --all-features
- name: Run cargo check (proofs) (just "test" feature)
run: cargo check -p proofs --no-default-features --features="test"
- name: Run cargo check (proofs) (just "blitzar" feature)
run: cargo check -p proofs --no-default-features --features="blitzar"

test:
name: Test Suite
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld
- name: Run cargo test
run: cargo test --all-features
- name: Dry run cargo test (proofs) (test feature only)
run: cargo test -p proofs --no-run --no-default-features --features="test"
- name: Dry run cargo test (proofs) (blitzar feature only)
run: cargo test -p proofs --no-run --no-default-features --features="blitzar"
- name: Dry run cargo test (proofs) (no features)
run: cargo test -p proofs --no-run --no-default-features
- name: Run cargo test (proof primitives - Dory) (no features - i.e. not using blitzar)
run: cargo test proof_primitive::dory::dory_compute_commitments_test --no-default-features
- name: Run hello_world example
run: cargo run --example hello_world --features="blitzar test"
- name: Run posql_db example
run: bash crates/proofs/examples/posql_db/run_example.sh

clippy:
name: Clippy
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env
rustup component add clippy
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

# Run cargo fmt --all -- --config imports_granularity=Crate,group_imports=One --check
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env
rustup component add rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --config imports_granularity=Crate,group_imports=One --check

udeps:
name: Unused Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install nightly toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default nightly
cargo install cargo-udeps --locked
- name: Run cargo udeps
run: cargo +nightly udeps --all-targets

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/proofs", "crates/proofs-sql", "crates/proofs-wasm-test"]
members = ["crates/proofs", "crates/proofs-sql"]

[workspace.package]
edition = "2021"
Expand Down

0 comments on commit 789ab89

Please sign in to comment.