Skip to content

Update ci.yml

Update ci.yml #31

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Build and run Docker containers
run: |
docker-compose up -d --build
- name: Wait for services to be ready
run: |
sleep 30 # 等待容器啟動
- name: Run backend tests
run: |
docker exec backend npm test
- name: Run control-backend tests
run: |
docker exec control-backend npm test
- name: Shutdown containers
run: |
docker-compose down