plugins/midnight-tooling/skills/midnight-ci/SKILL.md
Use when setting up CI/CD for Midnight projects, configuring GitHub Actions for Compact contract compilation, running TypeScript tests in CI, validating version consistency, or automating contract builds.
npx skillsauth add aaronbassett/midnight-knowledgebase midnight-tooling:midnight-ciInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Configure continuous integration for Midnight smart contract projects using GitHub Actions.
CI for Midnight projects should:
Copy the appropriate workflow template to your project:
mkdir -p .github/workflows
# For contract compilation
cp ${CLAUDE_PLUGIN_ROOT}/skills/midnight-ci/templates/github-workflows/compile-contracts.yml .github/workflows/
# For full dApp testing
cp ${CLAUDE_PLUGIN_ROOT}/skills/midnight-ci/templates/github-workflows/test-dapp.yml .github/workflows/
| Template | Purpose |
|----------|---------|
| compile-contracts.yml | Basic contract compilation check |
| test-dapp.yml | Full dApp testing with proof server |
| release.yml | Release workflow with versioning |
All workflows need these tools:
- name: Install Compact developer tools
run: |
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
echo "$HOME/.compact/bin" >> $GITHUB_PATH
- name: Install Compact compiler
run: compact update
Cache Compact compiler for faster builds:
- name: Cache Compact compiler
uses: actions/cache@v4
with:
path: ~/.compact
key: compact-${{ runner.os }}-${{ hashFiles('.compact-version') }}
restore-keys: |
compact-${{ runner.os }}-
Create .compact-version file:
0.26.0
For reproducible CI, pin the compiler version:
- name: Install specific compiler version
run: |
compact update 0.26.0
compact compile --version # Verify
Minimal workflow for contract compilation:
name: Compile Contracts
on: [push, pull_request]
jobs:
compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Compact
run: |
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
echo "$HOME/.compact/bin" >> $GITHUB_PATH
compact update
- name: Compile contracts
run: compact compile contracts/*.compact build/
Full testing with proof server:
name: Test dApp
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
proof-server:
image: midnightnetwork/proof-server:latest
ports:
- 6300:6300
options: >-
--health-cmd "curl -f http://localhost:6300/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# ... setup steps ...
- name: Run tests
run: npm test
env:
PROOF_SERVER_URL: http://localhost:6300
env:
NODE_VERSION: '20'
COMPACT_VERSION: '0.26.0'
PROOF_SERVER_TAG: '4.0.0'
- name: Install dependencies
run: npm ci
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: npm-${{ hashFiles('package-lock.json') }}
Add a version check step:
- name: Verify version consistency
run: |
COMPILER_VERSION=$(compact compile --version)
EXPECTED="0.26.0"
if [[ "$COMPILER_VERSION" != *"$EXPECTED"* ]]; then
echo "Version mismatch: expected $EXPECTED, got $COMPILER_VERSION"
exit 1
fi
Save compiled contracts:
- name: Upload compiled contracts
uses: actions/upload-artifact@v4
with:
name: contracts
path: build/
retention-days: 7
Ensure PATH is updated:
echo "$HOME/.compact/bin" >> $GITHUB_PATH
Increase startup time:
options: >-
--health-retries 10
--health-start-period 30s
Specify exact version:
node-version: '20.10.0'
Include version in cache key:
key: compact-${{ env.COMPACT_VERSION }}-${{ runner.os }}
templates/github-workflows/ - Ready-to-use workflow filesreferences/ci-best-practices.md - Detailed CI guidanceFor local environment setup, see the midnight-setup skill.
tools
Use when setting up Midnight development environment, installing Compact compiler and developer tools, configuring proof server, verifying prerequisites, or getting started with Midnight development.
tools
--- name: midnight-tooling:midnight-debugging description: Use when encountering Midnight errors like "compact: command not found", "ERR_UNSUPPORTED_DIR_IMPORT", version mismatches, proof server failures, "@midnight-ntwrk" package errors, or compilation failures. --- # Midnight Environment Debugging Expert knowledge for identifying and resolving common Midnight development toolchain issues. ## Diagnostic Approach When encountering Midnight-related errors, follow this systematic approach: 1.
tools
Use when checking Midnight version compatibility, understanding pragma language_version, verifying compiler and runtime version relationships, or troubleshooting version mismatch errors between Midnight components.
tools
Use when managing deployed contract lifecycles, inspecting contract state, backing up state before upgrades, planning contract migrations, implementing versioning strategies, or deprecating contracts gracefully.