A robust GitHub Action that ensures your services are ready before proceeding with workflow steps. This action performs intelligent service-specific health checks for various services, making it perfect for CI/CD pipelines where service dependencies need to be verified.
- 🚀 Multiple Service Support:
- MongoDB
- NATS
- Kafka
- PostgreSQL
- Redis
- Android Emulator
- Generic TCP service (fallback)
- ⏱️ Configurable Timeouts: Set custom wait times and check intervals
- 🔄 Indefinite Waiting: Option to wait indefinitely for services
- 🔍 Service-Specific Checks: Intelligent health checks for each service type
- 📊 Detailed Logging: Comprehensive status reporting and debugging information
- 🐳 Docker-based: Runs in a container with all necessary tools pre-installed
- name: Wait for PostgreSQL
uses: kula-app/wait-for-services-action@v1
with:
type: postgres
host: localhost
port: 5432
username: postgres
password: postgres
database: testdb- name: Wait for MongoDB
uses: kula-app/wait-for-services-action@v1
with:
type: mongodb
host: mongodb
port: 27017- name: Wait for NATS
uses: kula-app/wait-for-services-action@v1
with:
type: nats
host: nats
port: 4222- name: Wait for Kafka
uses: kula-app/wait-for-services-action@v1
with:
type: kafka
host: kafka
port: 9092- name: Wait for Redis
uses: kula-app/wait-for-services-action@v1
with:
type: redis
host: redis
port: 6379- name: Wait for Android Emulator
uses: kula-app/wait-for-services-action@v1
with:
type: android-emulator
host: phone
port: 5555| Input | Required | Default | Description |
|---|---|---|---|
type |
Yes | - | Service type (mongodb, nats, kafka, postgres, redis, android-emulator) |
host |
Yes | - | Host address of the service |
port |
Yes | - | Port number of the service |
timeout |
No | 20 |
Maximum seconds to wait for service readiness |
interval |
No | 1 |
Seconds between readiness checks |
wait-indefinitely |
No | false |
Continue waiting without timeout |
username |
No* | - | Username for PostgreSQL |
password |
No* | - | Password for PostgreSQL/Redis |
database |
No* | - | Database name for PostgreSQL |
*Required for specific services (PostgreSQL/Redis)
This action does not produce any outputs. It will:
- Exit with code 0 if the service becomes ready within the timeout
- Exit with code 1 if the service does not become ready within the timeout
- Fail the workflow step if the service is not ready
- Runner: Works on any GitHub Actions runner that supports Docker
- Architecture: Supports both
amd64andarm64architectures - Services: Compatible with the following service versions:
- MongoDB: 8.0.9+
- NATS: 2.11.3+
- Kafka: 3.7.0+
- PostgreSQL: 15+
- Redis: 7.4.3+
- Android Emulator: 30.1.2+
- Docker
- shfmt (for shell script formatting)
- Yarn 4.9.1+
- Clone the repository
- Install dependencies:
yarn install
- Format code:
make format
- Create a new service file in
src/services/directory - Implement a
check_servicename()function that returns 0 when service is ready - Update the
wait_for_service()function insrc/utils/wait.sh - Update
entrypoint.shto source your new service file - Add appropriate tests in
.github/workflows/
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request