Skip to content

feat: tighten CORS policy and improve payroll history empty states #630

feat: tighten CORS policy and improve payroll history empty states

feat: tighten CORS policy and improve payroll history empty states #630

Workflow file for this run

name: Build Project and Run Tests
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
env:
CARGO_TERM_COLOR: always
PKG_CONFIG_PATH: /usr/lib/pkgconfig
PUBLIC_STELLAR_NETWORK: local
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
runner/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Add the wasm32-unknown-unknown target for building contracts
- run: rustup target add wasm32-unknown-unknown
- run: sudo apt-get update && sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config
# Install binstall to quickly install stellar-scaffold-cli
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
# Check for stellar-scaffold-cli binary and install if not present
- name: Check for stellar-scaffold binary
run: |
if ! command -v stellar-scaffold &> /dev/null; then
echo "stellar-scaffold not found, installing..."
cargo binstall stellar-scaffold-cli --no-confirm
else
echo "stellar-scaffold already installed. Clear cache to force reinstall."
fi
- name: Build with Scaffold and build client packages
run: STELLAR_SCAFFOLD_ENV=development stellar-scaffold build --build-clients 2>&1 | tee build_clients.log
- name: Install official Stellar CLI
run: |
if ! command -v stellar &> /dev/null; then
cargo binstall stellar-cli --no-confirm
fi
- name: Ensure Stellar DB is initialized
run: |
stellar db init || true
- name: Wait for Stellar Quickstart health
run: |
echo "Waiting for Stellar RPC..."
for i in {1..30}; do
if curl -s http://localhost:8000/rpc > /dev/null; then
echo "Stellar RPC is up!"
break
fi
echo "Waiting... ($i/30)"
sleep 5
done
echo "Waiting for Friendbot..."
for i in {1..20}; do
if curl -s http://localhost:8000/friendbot | grep -q "status"; then
echo "Friendbot is up!"
break
fi
# Also check if it just returns a 400 (which means it's running but needs params)
if curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/friendbot | grep -q "400"; then
echo "Friendbot is reachable!"
break
fi
echo "Waiting for Friendbot... ($i/20)"
sleep 5
done
- name: Check client generation summary
run: |
# Extract the number after "Failed: "
FAILED=$(grep -Eo "Failed: [0-9]+" build_clients.log | awk '{print $2}')
if [ -z "$FAILED" ]; then
echo "Could not find 'Failed: N' in build_clients.log, all clients succeeded."
# Proceed even if not found, as output format might vary
fi
if [ "$FAILED" -gt 0 ]; then
echo "Client generation summary check failed: Failed: $FAILED"
echo "Check the \"Build with Scaffold\" step logs."
exit 1
fi
- name: Move packages to frontend
run: |
mkdir -p frontend/packages
# Copy generated packages if they exist in root packages/
if [ -d "packages" ]; then
cp -r packages/* frontend/packages/
fi
- name: Install Frontend Dependencies
working-directory: ./frontend
run: npm ci --legacy-peer-deps
- name: Lint Frontend
working-directory: ./frontend
run: npm run lint
- name: Check Formatting
working-directory: ./frontend
run: npx prettier . --check
- name: Build Frontend
working-directory: ./frontend
run: npm run build
- name: Run Tests
working-directory: ./frontend
run: npm test --if-present