works with some hiccups #3
This file contains hidden or 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 Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| test: | |
| name: Test BON Calculadora MCP Server | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Test make build | |
| run: | | |
| echo "ποΈ Testing make build..." | |
| make build | |
| # Verify build output exists | |
| if [ ! -f build/index.js ]; then | |
| echo "β build/index.js not found" | |
| exit 1 | |
| fi | |
| echo "β make build successful" | |
| - name: Test make test-stdio | |
| run: | | |
| echo "π Testing make test-stdio..." | |
| make test-stdio | |
| echo "β make test-stdio successful" | |
| - name: Test make pack and verify contents | |
| run: | | |
| echo "π¦ Testing make pack..." | |
| make pack | |
| # Check that a DXT file was created (find any .dxt file) | |
| DXT_FILE=$(ls *.dxt 2>/dev/null | head -1) | |
| if [ -z "$DXT_FILE" ]; then | |
| echo "β No .dxt file found" | |
| echo "Files in directory:" | |
| ls -la | |
| exit 1 | |
| fi | |
| echo "β Found DXT file: $DXT_FILE" | |
| # Install unzip if not available (should be available in ubuntu-latest) | |
| if ! command -v unzip &> /dev/null; then | |
| echo "Installing unzip..." | |
| sudo apt-get update && sudo apt-get install -y unzip | |
| fi | |
| # Extract the package using unzip | |
| echo "π Extracting package with unzip..." | |
| mkdir -p test-extract | |
| unzip -q "$DXT_FILE" -d test-extract | |
| # Show extracted contents for debugging | |
| echo "π Extracted contents:" | |
| find test-extract -type f | head -20 | |
| # Verify required files exist | |
| echo "π Verifying package contents..." | |
| if [ ! -d test-extract/build ]; then | |
| echo "β build/ directory missing" | |
| ls -la test-extract/ | |
| exit 1 | |
| fi | |
| echo "β build/ directory found" | |
| if [ ! -d test-extract/node_modules ]; then | |
| echo "β node_modules/ directory missing" | |
| ls -la test-extract/ | |
| exit 1 | |
| fi | |
| echo "β node_modules/ directory found" | |
| if [ ! -f test-extract/package.json ]; then | |
| echo "β package.json missing" | |
| ls -la test-extract/ | |
| exit 1 | |
| fi | |
| echo "β package.json found" | |
| if [ ! -f test-extract/package-lock.json ]; then | |
| echo "β package-lock.json missing" | |
| ls -la test-extract/ | |
| exit 1 | |
| fi | |
| echo "β package-lock.json found" | |
| if [ ! -f test-extract/manifest.json ]; then | |
| echo "β manifest.json missing" | |
| ls -la test-extract/ | |
| exit 1 | |
| fi | |
| echo "β manifest.json found" | |
| echo "β make pack successful - all required files present" | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Test image.sh build | |
| run: | | |
| echo "π³ Testing image.sh build..." | |
| # Make script executable | |
| chmod +x image.sh | |
| # Copy .env.sample to .env | |
| cp .env.sample .env | |
| echo "π³ Using .env.sample as .env for build test" | |
| # Check what container runtime is available (podman takes precedence) | |
| echo "π Checking available container runtimes..." | |
| CONTAINER_RUNTIME="" | |
| if command -v podman &> /dev/null; then | |
| echo "β Podman available: $(podman --version)" | |
| CONTAINER_RUNTIME="podman" | |
| elif command -v docker &> /dev/null; then | |
| echo "β Docker available: $(docker --version)" | |
| CONTAINER_RUNTIME="docker" | |
| else | |
| echo "β Neither Podman nor Docker found" | |
| exit 1 | |
| fi | |
| echo "π― Will use: $CONTAINER_RUNTIME" | |
| # Run the build | |
| ./image.sh build | |
| # Check images with the detected runtime first, then fallback to the other | |
| echo "π Checking for created images..." | |
| FOUND=false | |
| # Check with primary runtime | |
| echo "Checking with $CONTAINER_RUNTIME:" | |
| $CONTAINER_RUNTIME images || echo "$CONTAINER_RUNTIME images command failed" | |
| if $CONTAINER_RUNTIME images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then | |
| echo "β Found image with $CONTAINER_RUNTIME" | |
| FOUND=true | |
| fi | |
| # If not found and using podman, also check docker | |
| if [ "$FOUND" = false ] && [ "$CONTAINER_RUNTIME" = "podman" ] && command -v docker &> /dev/null; then | |
| echo "Checking with Docker as fallback:" | |
| docker images || echo "Docker images command failed" | |
| if docker images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then | |
| echo "β Found image with Docker" | |
| FOUND=true | |
| fi | |
| fi | |
| # If not found and using docker, also check podman | |
| if [ "$FOUND" = false ] && [ "$CONTAINER_RUNTIME" = "docker" ] && command -v podman &> /dev/null; then | |
| echo "Checking with Podman as fallback:" | |
| podman images || echo "Podman images command failed" | |
| if podman images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | grep -q "bon-calculadora-mcp"; then | |
| echo "β Found image with Podman" | |
| FOUND=true | |
| fi | |
| fi | |
| if [ "$FOUND" = false ]; then | |
| echo "β Container image not found with any runtime" | |
| echo "Podman images:" | |
| podman images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}" 2>/dev/null || echo "Podman not available" | |
| echo "Docker images:" | |
| docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}" 2>/dev/null || echo "Docker not available" | |
| exit 1 | |
| fi | |
| echo "β image.sh build successful" | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| *.dxt | |
| build/ | |
| retention-days: 7 |