-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial nightly build and refactor existing CI workflow
- Loading branch information
Showing
8 changed files
with
134 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[alias] | ||
xtask = "run --quiet --package xtask --" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
# temp | ||
- ci-refactor | ||
pull_request: | ||
merge_group: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
checks: | ||
name: Checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Run cargo fmt | ||
run: rustup toolchain install nightly && rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt && cargo +nightly fmt -- --check | ||
- name: Run cargo clippy | ||
run: cargo clippy -- -D warnings | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Get corelib | ||
run: git clone https://github.com/starkware-libs/cairo | ||
- name: Run cargo test | ||
run: CORELIB_PATH="$(pwd)/cairo/corelib/src" cargo test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Nightly | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build nightly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Upgrade Cairo to latest main commit | ||
run: cargo xtask upgrade cairo --rev $(git ls-remote --refs "https://github.com/starkware-libs/cairo" main | awk '{print $1}') | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Get corelib | ||
run: git clone https://github.com/starkware-libs/cairo | ||
- name: Run cargo test | ||
run: CORELIB_PATH="$(pwd)/cairo/corelib/src" cargo test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "xtask" | ||
version = "1.0.0" | ||
edition.workspace = true | ||
publish = false | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
clap.workspace = true | ||
cairo-toolchain-xtasks = "1" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use clap::Parser; | ||
|
||
macro_rules! command { | ||
($enum_name:ident ( $($module:ident,)+ )) => { | ||
$(mod $module;)+ | ||
|
||
#[derive(::clap::Subcommand)] | ||
#[allow(non_camel_case_types)] | ||
enum $enum_name { | ||
$($module(crate::$module::Args),)+ | ||
} | ||
|
||
impl $enum_name { | ||
fn main(self) -> ::anyhow::Result<()> { | ||
match self { | ||
$(Self::$module(args) => crate::$module::main(args),)+ | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
command!(Command(upgrade,)); | ||
|
||
#[derive(Parser)] | ||
struct Args { | ||
#[command(subcommand)] | ||
command: Command, | ||
} | ||
|
||
fn main() { | ||
let _ = Args::parse().command.main(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub use cairo_toolchain_xtasks::upgrade::{main, Args}; |