Skip to content

Commit

Permalink
[CI]: add workflow (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
manlikeHB authored Mar 2, 2025
1 parent 590b77c commit 9ff6522
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cairo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: LyricsFlip Contracts

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- run: scarb fmt --check
working-directory: onchain
- run: scarb build
working-directory: onchain

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- run: snforge test
working-directory: onchain
44 changes: 23 additions & 21 deletions onchain/src/tests/test_lyricsflip.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -1371,17 +1371,18 @@ fn test_start_round_should_panic_if_not_admin_or_participant() {
stop_cheat_caller_address(lyricsflip.contract_address);

start_cheat_caller_address(lyricsflip.contract_address, ADMIN_ADDRESS());
for i in 0..5_u64 {
let card = Card {
card_id: i.into(),
genre: Genre::HipHop,
artist: 'Bob Marley',
title: "",
year: 2000,
lyrics: "Lorem Ipsum",
for i in 0
..5_u64 {
let card = Card {
card_id: i.into(),
genre: Genre::HipHop,
artist: 'Bob Marley',
title: "",
year: 2000,
lyrics: "Lorem Ipsum",
};
lyricsflip.add_card(card);
};
lyricsflip.add_card(card);
};

lyricsflip.set_cards_per_round(5);
stop_cheat_caller_address(lyricsflip.contract_address);
Expand Down Expand Up @@ -1409,17 +1410,18 @@ fn test_start_round_by_admin_or_participant() {
stop_cheat_caller_address(lyricsflip.contract_address);

start_cheat_caller_address(lyricsflip.contract_address, ADMIN_ADDRESS());
for i in 0..10_u64 {
let card = Card {
card_id: i.into(),
genre: Genre::HipHop,
artist: 'Bob Marley',
title: "",
year: 2000,
lyrics: "Lorem Ipsum",
for i in 0
..10_u64 {
let card = Card {
card_id: i.into(),
genre: Genre::HipHop,
artist: 'Bob Marley',
title: "",
year: 2000,
lyrics: "Lorem Ipsum",
};
lyricsflip.add_card(card);
};
lyricsflip.add_card(card);
};

let valid_cards_per_round = 5;
lyricsflip.set_cards_per_round(valid_cards_per_round);
Expand Down Expand Up @@ -1485,4 +1487,4 @@ fn test_start_round_by_admin_or_participant() {
);

stop_cheat_block_timestamp_global();
}
}

0 comments on commit 9ff6522

Please sign in to comment.