Skip to content

Commit

Permalink
Update file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Dec 4, 2024
1 parent 64a90f7 commit 01948a7
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 31 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/cadence_lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Cadence Lint
name: Run Cadence Contract Compilation, Deployment, Transaction Execution, and Lint
on: push

jobs:
Expand All @@ -9,7 +9,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Install Flow CLI
run: |
brew update
Expand All @@ -23,8 +23,29 @@ jobs:
else
echo "Flow project already initialized."
fi
flow dependencies install
- name: Start Flow Emulator
run: |
echo "Starting Flow emulator in the background..."
nohup flow emulator start > emulator.log 2>&1 &
sleep 5 # Wait for the emulator to start
flow project deploy --network=emulator # Deploy the recipe contracts indicated in flow.json
- name: Run All Transactions
run: |
echo "Running all transactions in the transactions folder..."
for file in ./cadence/transactions/*.cdc; do
echo "Running transaction: $file"
TRANSACTION_OUTPUT=$(flow transactions send "$file" --signer emulator-account)
echo "$TRANSACTION_OUTPUT"
if echo "$TRANSACTION_OUTPUT" | grep -q "Transaction Error"; then
echo "Transaction Error detected in $file, failing the action..."
exit 1
fi
done
- name: Run Cadence Lint
run: |
echo "Running Cadence linter on all .cdc files in the current repository"
flow cadence lint **/*.cdc
echo "Running Cadence linter on .cdc files in the current repository"
flow cadence lint ./cadence/**/*.cdc
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
.DS_Store
/imports/
/.idea/
11 changes: 0 additions & 11 deletions cadence/contract.cdc

This file was deleted.

13 changes: 13 additions & 0 deletions cadence/contracts/Recipe.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
access(all) contract Recipe {
// Admin is a special authorization resource that
// allows the owner to perform important NFT
// functions
//
access(all) resource Admin {

access(all) fun createNewAdmin(): @Admin {
return <-create Admin()
}

}
}
6 changes: 6 additions & 0 deletions cadence/tests/Recipe_test.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test

access(all) fun testExample() {
let array = [1, 2, 3]
Test.expect(array.length, Test.equal(3))
}
File renamed without changes.
1 change: 1 addition & 0 deletions emulator-account.pkey
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xdc07d83a937644ff362b279501b7f7a3735ac91a0f3647147acf649dda804e28
44 changes: 29 additions & 15 deletions flow.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{
"contracts": {
"Counter": {
"source": "cadence/contracts/Counter.cdc",
"aliases": {
"testing": "0000000000000007"
}
}
},
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"testing": "127.0.0.1:3569",
"testnet": "access.devnet.nodes.onflow.org:9000"
}
}
"contracts": {
"Recipe": {
"source": "./cadence/contract.cdc",
"aliases": {
"emulator": "0xf8d6e0586b0a20c7"
}
}
},
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"testing": "127.0.0.1:3569",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"accounts": {
"emulator-account": {
"address": "f8d6e0586b0a20c7",
"key": {
"type": "file",
"location": "emulator-account.pkey"
}
}
},
"deployments": {
"emulator": {
"emulator-account": ["Recipe"]
}
}
}

0 comments on commit 01948a7

Please sign in to comment.