Ability to ignore threads #116 #236
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: Dev Setup | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| dev-setup: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| # The runner has podman installed, but only the Docker daemon is running. | |
| # Force the Taskfile's compose engine to docker so it doesn't pick podman. | |
| ENGINE: docker | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare dev env file | |
| run: | | |
| cp .env.development.example .env.development | |
| # Dev env requires Active Record encryption keys for OAuth token storage. | |
| for key in RAILS_AR_ENCRYPTION_PRIMARY_KEY RAILS_AR_ENCRYPTION_DETERMINISTIC_KEY RAILS_AR_ENCRYPTION_SALT; do | |
| value=$(ruby -rsecurerandom -e 'puts SecureRandom.alphanumeric(32)') | |
| sed -i "s|^${key}=.*|${key}=${value}|" .env.development | |
| done | |
| - name: Start dev stack | |
| run: task dev-detach | |
| - name: Wait for Rails to be healthy | |
| run: | | |
| echo "Waiting for Rails to start..." | |
| for i in {1..60}; do | |
| if docker compose -f compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then | |
| echo "Rails is healthy!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/60 - waiting 5s..." | |
| sleep 5 | |
| done | |
| echo "Rails failed to start. Showing logs:" | |
| docker compose -f compose.dev.yml logs --tail=200 web db | |
| exit 1 | |
| - name: Run db-reset while stack is running | |
| run: task db-reset | |
| - name: Wait for web to restart | |
| run: | | |
| echo "Waiting for web to restart after db-reset..." | |
| for i in {1..30}; do | |
| if docker compose -f compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then | |
| echo "Web is healthy after db-reset!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/30 - waiting 5s..." | |
| sleep 5 | |
| done | |
| echo "Web failed to restart. Showing logs:" | |
| docker compose -f compose.dev.yml logs --tail=200 web db | |
| exit 1 | |
| - name: Run RSpec tests | |
| run: task test | |
| - name: Teardown | |
| if: always() | |
| run: task down |