Mina Local Network Workflow 🪶 #32
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: Mina Local Network Workflow 🪶 | |
on: | |
workflow_dispatch: | |
jobs: | |
mina-network-job: | |
runs-on: ubuntu-latest | |
services: | |
mina-local-network: | |
image: o1labs/mina-local-network:o1js-main-latest-lightnet | |
env: | |
NETWORK_TYPE: 'single-node' | |
PROOF_LEVEL: 'none' | |
LOG_LEVEL: 'Info' | |
ports: | |
- 3085:3085 | |
- 5432:5432 | |
- 8080:8080 | |
- 8181:8181 | |
- 8282:8282 | |
volumes: | |
- /tmp:/root/logs | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/setup | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TURBO_SERVER_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }} | |
- name: Install jq if not present | |
run: | | |
if ! command -v jq &> /dev/null | |
then | |
echo "jq could not be found, installing..." | |
sudo apt-get update | |
sudo apt-get install -y jq | |
else | |
echo "jq is already installed" | |
fi | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build Packages | |
run: pnpm b | |
- name: Wait for Mina Network readiness | |
uses: o1-labs/wait-for-mina-network-action@v1 | |
with: | |
mina-graphql-port: 8080 | |
- name: Check Mina Accounts Manager readiness | |
run: | | |
curl -f http://localhost:8181/acquire-account || exit 1 | |
- name: Acquire Mina Account | |
id: acquire_account | |
run: | | |
response=$(curl -s http://localhost:8181/acquire-account) | |
pk=$(echo $response | jq -r '.pk') | |
echo "PUBLIC_KEY=$pk" >> $GITHUB_ENV | |
- name: Get Public Key on Local Network | |
env: | |
PUBLIC_KEY: ${{ env.PUBLIC_KEY }} | |
NODE_URL: http://localhost:8080/graphql | |
run: | | |
curl -X POST -H "Content-Type: application/json" \ | |
--data '{ | |
"query": "query accountBalance($publicKey: PublicKey!) { account(publicKey: $publicKey) { balance { total }, nonce, inferredNonce, delegate, publicKey } }", | |
"variables": { "publicKey": "'"${PUBLIC_KEY}"'" } | |
}' \ | |
$NODE_URL | |
- name: Fetch Transactions and Set Environment Variables | |
env: | |
PUBLIC_KEY: ${{ env.PUBLIC_KEY }} | |
ARCHIVE_NODE_URL: http://localhost:8282 | |
run: | | |
curl -X POST -H "Content-Type: application/json" \ | |
--data '{ | |
"query": "query Transactions($address: String!, $limit: Int) { transactions(query: { canonical: true, OR: [{ to: $address }, { from: $address }] } limit: $limit sortBy: DATETIME_DESC) { amount to token kind isDelegation hash from fee failureReason dateTime blockHeight } }", | |
"variables": { "address": "'"${PUBLIC_KEY}"'", "limit": 1 } | |
}' \ | |
$ARCHIVE_NODE_URL | |
- name: Run Account Provider Tests | |
env: | |
PUBLIC_KEY: ${{ env.PUBLIC_KEY }} | |
NODE_URL: http://127.0.0.1:8080/graphql | |
ARCHIVE_NODE_URL: http://127.0.0.1:8282/graphql | |
TX_HASH: ${{ env.TX_HASH }} | |
TX_ID: ${{ env.TX_ID }} | |
run: | | |
cd packages/mina-graphql | |
pnpm test:unit | |
- name: Upload Mina logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mina-logs | |
path: /tmp/*.log | |
retention-days: 5 |