Skip to content

spoo-me/setup-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Spoo.me Setup Action

A reusable GitHub Action to run the spoo.me URL shortener locally in CI πŸš€

πŸš€ Quick Start βš™οΈ Inputs πŸ“€ Outputs πŸ“š Examples πŸ› Troubleshooting

Test Action License

⚑ Introduction

A reusable GitHub Action that automatically sets up the spoo.me URL shortener service locally within any GitHub Actions workflow. This action handles all the complexity of setting up MongoDB, Redis, Python dependencies, and the FastAPI service itself.

πŸ”₯ Features

  • Reusable - Use in any repository with uses: spoo-me/setup-action@v2 πŸ”„
  • Complete Environment - Automatically installs and configures Python, MongoDB, and Redis ⚑
  • FastAPI + Uvicorn - Starts the service with uvicorn for production-grade performance πŸš€
  • Health Monitoring - Verifies all services via the /health endpoint before proceeding πŸ”
  • Configurable - Supports custom versions for Python, MongoDB, and Redis βš™οΈ
  • Fast Startup - Optimized MongoDB setup (single instance, not replica set) ⚑
  • Clean Integration - Easy to integrate into existing workflows as a single step 🎯

πŸš€ Quick Start

Basic Usage

name: Test with Spoo.me Service

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Spoo.me Service
        uses: spoo-me/setup-action@v2
        id: spoo-setup

      - name: Run tests against Spoo.me
        run: |
          echo "Service running at: ${{ steps.spoo-setup.outputs.service-url }}"
          curl -s ${{ steps.spoo-setup.outputs.health-url }}

Advanced Usage with Custom Configuration

name: Integration Tests

on: [push]

jobs:
  integration-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Spoo.me Service
        uses: spoo-me/setup-action@v2
        id: spoo-setup
        with:
          python-version: '3.13'
          mongodb-version: '7.0'
          redis-version: '7.2'
          spoo-directory: 'my-spoo-instance'
          wait-timeout: '180'

      - name: Test URL shortening API
        run: |
          echo "Testing against: ${{ steps.spoo-setup.outputs.service-url }}"
          echo "Health: ${{ steps.spoo-setup.outputs.health-url }}"
          echo "MongoDB: ${{ steps.spoo-setup.outputs.mongodb-uri }}"
          echo "Redis: ${{ steps.spoo-setup.outputs.redis-uri }}"

βš™οΈ Inputs

Input Description Required Default
python-version Python version to install No 3.13
mongodb-version MongoDB version to use No 7.0
redis-version Redis version to use No 7.2
spoo-directory Directory to clone spoo.me repository No spoo-me
wait-timeout Timeout in seconds to wait for services No 120

πŸ“€ Outputs

Output Description Example
service-url URL where the spoo.me service is running http://127.0.0.1:8000
health-url URL for the health check endpoint http://127.0.0.1:8000/health
mongodb-uri MongoDB connection URI (includes database name) mongodb://localhost:27017/url-shortener
redis-uri Redis connection URI redis://localhost:6379

πŸ”§ Environment Configuration

The action automatically configures the following environment variables for the spoo.me service:

# MongoDB connection details
MONGODB_URI=mongodb://localhost:27017/
DB_NAME=url-shortener

# Redis connection details
REDIS_URI=redis://localhost:6379
REDIS_TTL_SECONDS=3600

# App configs
SECRET_KEY=<auto-generated>
HOST_URI=127.0.0.1:8000
ENV=development
APP_URL=http://127.0.0.1:8000

# JWT (HS256 mode β€” no RSA keys needed in CI)
JWT_SECRET=<auto-generated>
JWT_ISSUER=spoo.me
JWT_AUDIENCE=spoo.me.api
COOKIE_SECURE=false

# Logging
LOG_LEVEL=INFO
LOG_FORMAT=console

# Disabled in CI: Sentry, OAuth, Email, hCaptcha

Note

SECRET_KEY and JWT_SECRET are randomly generated at setup time. OAuth, Sentry, and email are left unconfigured β€” the app runs fine without them.

πŸ“Š What the Action Does

  1. 🐍 Python Setup - Installs the specified Python version
  2. πŸƒ MongoDB Setup - Starts optimized single-instance MongoDB (faster than replica sets)
  3. πŸ”΄ Redis Setup - Starts Redis service on the default port
  4. βœ… Service Verification - Verifies both databases are accessible
  5. πŸ“¦ Repository Cloning - Clones the spoo.me URL shortener repository
  6. πŸš€ UV Installation - Installs uv for fast Python package management
  7. βš™οΈ Environment Configuration - Sets up all required environment variables
  8. πŸ“¦ Dependency Installation - Installs Python dependencies using uv sync
  9. 🌐 Service Startup - Starts the FastAPI service with uvicorn in the background
  10. πŸ” Health Checks - Verifies the service is running via GET /health

πŸ“š Usage Examples

Integration Testing

name: Integration Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Spoo.me
        uses: spoo-me/setup-action@v2
        id: spoo

      - name: Run integration tests
        run: |
          # Test URL shortening
          response=$(curl -s -X POST \
            -H "Content-Type: application/x-www-form-urlencoded" \
            -d "url=https://example.com" \
            ${{ steps.spoo.outputs.service-url }}/)
          echo "API Response: $response"

Multi-Version Testing

name: Multi-Version Test

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.12', '3.13']
        mongodb-version: ['7.0', '8.0']

    steps:
      - uses: actions/checkout@v4

      - name: Setup Spoo.me
        uses: spoo-me/setup-action@v2
        with:
          python-version: ${{ matrix.python-version }}
          mongodb-version: ${{ matrix.mongodb-version }}

Load Testing

name: Load Testing

on: workflow_dispatch

jobs:
  load-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Spoo.me
        uses: spoo-me/setup-action@v2
        with:
          wait-timeout: '300'
        id: spoo

      - name: Install Apache Bench
        run: sudo apt-get update && sudo apt-get install -y apache2-utils

      - name: Run load test
        run: |
          echo "Running load test against ${{ steps.spoo.outputs.service-url }}"
          ab -n 1000 -c 10 ${{ steps.spoo.outputs.service-url }}/

πŸ› Troubleshooting

Service Not Starting

If the service fails to start, check the logs:

- name: Check service logs
  if: failure()
  run: |
    cd spoo-me  # or your custom directory
    cat spoo-service.log

Health Check Returns "degraded"

This means MongoDB is fine but Redis isn't connected. The service still works β€” Redis is optional for caching. Check:

- name: Check health
  run: curl -s http://127.0.0.1:8000/health | python3 -m json.tool

Common Issues

  • Timeout errors: Increase wait-timeout to 180 or higher
  • Port conflicts: The action uses standard ports (27017 for MongoDB, 6379 for Redis, 8000 for the service)
  • Python version compatibility: Use Python 3.12 or higher for best compatibility
  • MongoDB slow startup: Uses single instance (not replica set) for faster startup

πŸ—‚οΈ Repository Structure

setup-action/
β”œβ”€β”€ action.yml                     # Main action definition
β”œβ”€β”€ README.md                      # This documentation
β”œβ”€β”€ USAGE.md                       # Quick usage guide
β”œβ”€β”€ LICENSE                        # Apache 2.0 License
β”œβ”€β”€ SECURITY.md                    # Security policy
β”œβ”€β”€ CODE_OF_CONDUCT.md             # Code of conduct
└── .github/
    └── workflows/
        └── test.yml               # Comprehensive test workflow

πŸ”„ Versioning

This action follows semantic versioning. Available versions:

  • @v2 - Latest stable v2.x release (recommended)
  • @v2.0.0 - Specific version
  • @v1 - Legacy (Flask-based spoo.me)
  • @main - Latest development version (not recommended for production)

🀝 Contributing

Contributions are always welcome! πŸŽ‰ Here's how you can contribute:

Important

For any type of support or queries, feel free to reach out to us at βœ‰οΈ support@spoo.me

πŸ™ Acknowledgments



Β© spoo.me . 2026

All Rights Reserved