Lint command #13
Workflow file for this run
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
name: Run Cadence Lint | |
on: push | |
jobs: | |
run-cadence-lint: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Install Flow CLI | |
run: | | |
brew update | |
brew install flow-cli | |
- name: Initialize Flow | |
run: | | |
if [ ! -f flow.json ]; then | |
echo "Initializing Flow project..." | |
flow init | |
else | |
echo "Flow project already initialized." | |
fi | |
- 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 Transaction | |
run: | | |
echo "Running recipe transaction with Flow emulator..." | |
TRANSACTION_OUTPUT=$(flow transactions send cadence/transaction.cdc --signer emulator-account) | |
echo "$TRANSACTION_OUTPUT" | |
if echo "$TRANSACTION_OUTPUT" | grep -q "Transaction Error"; then | |
echo "Transaction Error detected, failing the action..." | |
exit 1 | |
fi | |
- name: Run Cadence Lint | |
run: | | |
echo "Running Cadence linter on .cdc files in the current repository" | |
flow cadence lint ./cadence/contract.cdc | |
flow cadence lint ./cadence/transaction.cdc |