Skip to content

Commit

Permalink
First CI commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alon-dotan-starkware committed Feb 18, 2024
0 parents commit 2528d3b
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ignore:
- "crates/**/*test*.rs"
coverage:
status:
project:
default:
target: auto # set the target coverage to the value of the parent commit
threshold: 0% # pct of drop in coverage that is still considered as success
informational: true # if true does not fail the CI is coverage is bellow the target value
only_pulls: true # run only on PRs
patch:
default:
target: 100%
threshold: 0%
informational: true
only_pulls: true
111 changes: 111 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: CI

on:
push:
branches:
- main
- main-v[0-9].**
tags:
- v[0-9].**

pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
- edited

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install commitlint
run: npm install --global @commitlint/cli @commitlint/config-conventional

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request' && !(contains(github.event.pull_request.title, '/merge-main') || contains(github.event.pull_request.title, '/merge main'))
run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: Validate PR title with commitlint
if: github.event_name != 'merge_group' && github.event_name != 'push' && !(contains(github.event.pull_request.title, '/merge-main') || contains(github.event.pull_request.title, '/merge main'))
run: echo "${{ github.event.pull_request.title }}" | commitlint --verbose

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
- run: scripts/rust_fmt.sh --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: scripts/clippy.sh

run-python-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- run: |
python -m pip install --upgrade pip
pip install pytest
- run: pytest scripts/merge_paths_test.py

run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test

udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
name: "Rust Toolchain Setup"
with:
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
id: "cache-cargo"
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
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
env:
RUSTUP_TOOLCHAIN: nightly-2024-01-12


all-tests:
runs-on: ubuntu-latest
needs:
- clippy
- commitlint
- format
- run-python-tests
- run-tests
- udeps
steps:
- name: Decide whether all the needed jobs succeeded or failed
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
34 changes: 34 additions & 0 deletions .github/workflows/compiled_cairo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
tags:
- v[0-9].**

pull_request:
types:
- opened
- reopened
- synchronize
paths:
- 'crates/blockifier/feature_contracts/cairo0/**'

jobs:
verify_cairo_file_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- run:
pip install -r crates/blockifier/tests/requirements.txt;
cargo test verify_feature_contracts -- --include-ignored
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Coverage

on: [pull_request, push]

jobs:
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --codecov --output-path codecov.json
env:
SEED: 0
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
24 changes: 24 additions & 0 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: post-merge

on:
pull_request:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- run:
pip install -r crates/blockifier/tests/requirements.txt;
cargo test -- --include-ignored
20 changes: 20 additions & 0 deletions .github/workflows/verify-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Nightly Latest Dependencies Check

on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day

jobs:
latest_deps:
name: Latest Dependencies
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Update Dependencies
run: cargo update --verbose
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.egg-info
/data
/logs
build
dist
target
*/.vscode/*
*.DS_Store

tmp_venv/*

4 changes: 4 additions & 0 deletions scripts/clippy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cargo clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \
-D nonstandard-style -D rust-2018-idioms -D unused
Loading

0 comments on commit 2528d3b

Please sign in to comment.