Update README.md #76
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [smart-contracts, backend, frontend] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Set up Node.js (for Smart Contracts & Frontend) | |
if: matrix.component == 'smart-contracts' || matrix.component == 'frontend' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Set up Python (for Backend) | |
if: matrix.component == 'backend' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.13' | |
- name: Install dependencies | |
if: matrix.component == 'smart-contracts' | |
run: | | |
cd smartContracts | |
npm ci | |
# Export Secrets for Hardhat | |
- name: Export Environment Variables | |
env: | |
TESTNET_URL: ${{ secrets.TESTNET_URL }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: | | |
echo "TESTNET_URL=${TESTNET_URL}" >> $GITHUB_ENV | |
echo "PRIVATE_KEY=${PRIVATE_KEY}" >> $GITHUB_ENV | |
- name: Debug Environment Variables | |
if: matrix.component == 'smart-contracts' | |
run: | | |
echo "TESTNET_URL: ${TESTNET_URL:-Not Set}" | |
echo "PRIVATE_KEY: ${PRIVATE_KEY:-Not Set}" | |
- name: Debug Hardhat config | |
if: matrix.component == 'smart-contracts' | |
run: | | |
echo "Using private key length: ${#PRIVATE_KEY}" | |
- name: Compile and test Smart Contracts | |
if: matrix.component == 'smart-contracts' | |
run: | | |
cd smartContracts | |
npx hardhat compile | |
npx hardhat test --verbose | |
- name: Install backend dependencies | |
if: matrix.component == 'backend' | |
run: | | |
cd backend | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Install Frontend dependencies | |
if: matrix.component == 'frontend' | |
run: | | |
cd client | |
npm ci || echo "Ignoring warnings..." | |
- name: Build Frontend | |
if: matrix.component == 'frontend' | |
run: | | |
cd client | |
npm run build | |
env: | |
CI: false | |