Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add actions #17

Merged
merged 9 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: CI

on:
push:
branches: [main]
pull_request:
merge_group:
types: [checks_requested]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
check:
name: clippy
runs-on: ubuntu-latest
env:
MLIR_SYS_180_PREFIX: /usr/lib/llvm-18/
LLVM_SYS_180_PREFIX: /usr/lib/llvm-18/
TABLEGEN_180_PREFIX: /usr/lib/llvm-18/
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Add LLVM Debian repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-18 llvm-18-dev llvm-18-runtime clang-18 clang-tools-18 lld-18 libpolly-18-dev libmlir-18-dev mlir-18-tools
- name: Clippy
run: cargo clippy --all-targets -- -D warnings

format:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: rustfmt
- run: cargo fmt --all -- --check
- name: Find Comment
continue-on-error: true
if: success() || failure()
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: thiscommentistofindthisformatcomment
- name: Create or update comment
continue-on-error: true
if: failure()
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
❌ Code is not formatted! Please run `cargo format` and push the changes.

<!-- thiscommentistofindthisformatcomment -->
edit-mode: replace
- name: Create or update comment
continue-on-error: true
if: ${{ success() && steps.fc.outputs.comment-id != null }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
✅ Code is now correctly formatted.

<!-- thiscommentistofindthisformatcomment -->
edit-mode: replace

# Check for unnecessary dependencies.
udeps:
runs-on: ubuntu-latest
env:
MLIR_SYS_180_PREFIX: /usr/lib/llvm-18/
LLVM_SYS_180_PREFIX: /usr/lib/llvm-18/
TABLEGEN_180_PREFIX: /usr/lib/llvm-18/
RUSTUP_TOOLCHAIN: nightly-2024-02-01 # udeps needs nightly
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-02-01
components: rustfmt

- name: Add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-18 llvm-18-dev llvm-18-runtime clang-18 clang-tools-18 lld-18 libpolly-18-dev libmlir-18-dev mlir-18-tools
- name: Download and run cargo-udeps
run: |
wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar -xz
cargo-udeps-*/cargo-udeps udeps --all-targets

test:
name: test (linux, amd64)
runs-on: ubuntu-latest
env:
MLIR_SYS_180_PREFIX: /usr/lib/llvm-18/
LLVM_SYS_180_PREFIX: /usr/lib/llvm-18/
TABLEGEN_180_PREFIX: /usr/lib/llvm-18/
RPC_ENDPOINT_TESTNET: ${{ secrets.RPC_ENDPOINT_TESTNET }}
RPC_ENDPOINT_MAINNET: ${{ secrets.RPC_ENDPOINT_MAINNET }}
RUST_LOG: debug,replay=trace,rpc-state-reader=trace
steps:
- uses: actions/checkout@v4
- name: Free HDD space
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- name: Setup rust env
uses: dtolnay/[email protected]
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: Add LLVM Debian repository
uses: myci-actions/add-deb-repo@11
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- run: sudo apt-get update && sudo apt-get upgrade -y
- name: Install LLVM
run: sudo apt-get install llvm-18 llvm-18-dev llvm-18-runtime clang-18 clang-tools-18 lld-18 libpolly-18-dev libmlir-18-dev mlir-18-tools
- name: Checkout cairo_native
uses: actions/checkout@v4
with:
repository: lambdaclass/cairo_native
ref: 66e9b5e053faf3b2a9129de5b15205d1cfe686eb
path: cairo_native
- name: Build Cairo Native Runtime Library
shell: bash
run: |
cd cairo_native
make runtime
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV
- name: Test
run: cargo test
92 changes: 5 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion replay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ rpc-state-reader = { path = "../rpc-state-reader" }
starknet_api = { workspace = true }
# CLI specific crates
clap = { version = "4.4.6", features = ["derive"] }
indicatif = "0.17.7"
# logs
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
Loading