Scrapix V2 #7
This file contains 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: Test | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Start test environment | |
run: | | |
docker-compose up -d | |
docker ps -a | |
- name: Make wait-for-it.sh executable | |
run: chmod +x .github/scripts/wait-for-it.sh | |
- name: Wait for services | |
run: | | |
.github/scripts/wait-for-it.sh localhost:7700 -t 60 | |
.github/scripts/wait-for-it.sh localhost:3000 -t 60 | |
.github/scripts/wait-for-it.sh localhost:8080 -t 60 | |
sleep 10 # Give services extra time to fully initialize | |
- name: Debug service logs | |
if: always() | |
run: | | |
echo "=== Meilisearch Logs ===" | |
docker-compose logs meilisearch | |
echo "=== Playground Logs ===" | |
docker-compose logs playground | |
echo "=== Scraper Logs ===" | |
docker-compose logs scraper | |
echo "=== Redis Logs ===" | |
docker-compose logs redis | |
- name: Run tests | |
run: npm run test | |
- name: Show test logs on failure | |
if: failure() | |
run: | | |
echo "=== Service Status ===" | |
docker-compose ps | |
echo "=== Recent Logs ===" | |
docker-compose logs --tail=100 | |
- name: Cleanup | |
if: always() | |
run: docker-compose down -v |