fix: support the setup script on selinux (#15) #17
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: Smoke Test Services | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'on-prem/docker-compose.*.yml' | |
| - 'on-prem/templates/**' | |
| - 'on-prem/scripts/**' | |
| - '.env.example' | |
| pull_request: | |
| paths: | |
| - 'on-prem/docker-compose.*.yml' | |
| - 'on-prem/templates/**' | |
| - 'on-prem/scripts/**' | |
| - '.env.example' | |
| workflow_dispatch: | |
| jobs: | |
| smoke-test: | |
| name: API Smoke Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read # Required for checkout | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::761136292957:role/GitHubActions-CurrentsDevDocker-ECRPull | |
| aws-region: us-east-1 | |
| - name: Login to Currents ECR | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registries: "513558712013" | |
| - name: Setup environment | |
| working-directory: on-prem | |
| run: ./scripts/setup.sh --env-only --force | |
| - name: Start infrastructure services | |
| working-directory: on-prem | |
| run: | | |
| echo "Starting Redis, MongoDB, and MongoDB init..." | |
| docker compose -f docker-compose.full.yml up -d redis mongodb | |
| echo "Waiting for services to initialize..." | |
| - name: Wait for Redis | |
| working-directory: on-prem | |
| run: | | |
| echo "Waiting for Redis to be ready..." | |
| for i in {1..30}; do | |
| if docker compose -f docker-compose.full.yml exec -T redis redis-cli ping | grep -q PONG; then | |
| echo "✅ Redis is ready" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/30 - Redis not ready yet..." | |
| sleep 2 | |
| done | |
| echo "❌ Redis failed to start" | |
| docker compose -f docker-compose.full.yml logs redis | |
| exit 1 | |
| - name: Wait for MongoDB | |
| working-directory: on-prem | |
| run: | | |
| echo "Waiting for MongoDB to be healthy..." | |
| for i in {1..60}; do | |
| if docker compose -f docker-compose.full.yml exec -T mongodb mongosh --quiet --eval "db.runCommand('ping').ok" localhost:27017 2>/dev/null | grep -q 1; then | |
| echo "✅ MongoDB is ready" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/60 - MongoDB not ready yet..." | |
| sleep 2 | |
| done | |
| echo "❌ MongoDB failed to start" | |
| docker compose -f docker-compose.full.yml logs mongodb | |
| exit 1 | |
| - name: Start application services | |
| working-directory: on-prem | |
| run: | | |
| echo "Starting Scheduler and API..." | |
| docker compose -f docker-compose.full.yml up -d scheduler api | |
| echo "Waiting for services to initialize..." | |
| - name: Wait for API | |
| working-directory: on-prem | |
| run: | | |
| echo "Waiting for API to be ready..." | |
| for i in {1..60}; do | |
| if curl -sf http://localhost:4000/health > /dev/null 2>&1; then | |
| echo "✅ API is ready" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/60 - API not ready yet..." | |
| sleep 2 | |
| done | |
| echo "❌ API failed to start" | |
| docker compose -f docker-compose.full.yml logs api | |
| exit 1 | |
| - name: Wait for root user | |
| working-directory: on-prem | |
| run: | | |
| source .env | |
| echo "Waiting for root user to be created..." | |
| for i in {1..30}; do | |
| if docker compose -f docker-compose.full.yml exec -T mongodb mongosh \ | |
| -u "$MONGODB_USERNAME" -p "$MONGODB_PASSWORD" --authenticationDatabase admin \ | |
| --quiet --eval "db.getSiblingDB('currents').user.findOne({email: '${ON_PREM_EMAIL:-root@currents.local}'})" 2>/dev/null | grep -q "_id"; then | |
| echo "✅ Root user exists" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/30 - Root user not created yet..." | |
| sleep 2 | |
| done | |
| echo "❌ Root user was not created" | |
| docker compose -f docker-compose.full.yml logs api scheduler | |
| exit 1 | |
| - name: Seed database | |
| id: seed | |
| working-directory: on-prem | |
| run: | | |
| echo "Seeding database with test data..." | |
| # Capture the KEY=VALUE output from seed script | |
| eval $(./scripts/smoke-test/seed-database.sh) | |
| # Export to GitHub Actions output | |
| echo "api_key=${API_KEY}" >> $GITHUB_OUTPUT | |
| echo "project_id=${PROJECT_ID}" >> $GITHUB_OUTPUT | |
| - name: Run API smoke test | |
| working-directory: on-prem | |
| run: | | |
| echo "Running API smoke test..." | |
| ./scripts/smoke-test/api-test.sh "${{ steps.seed.outputs.api_key }}" "${{ steps.seed.outputs.project_id }}" | |
| - name: Cleanup | |
| if: always() | |
| working-directory: on-prem | |
| run: | | |
| docker compose -f docker-compose.full.yml down -v --remove-orphans |