Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/docker-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,76 @@ on:
- created

jobs:
docker-check-v2:
name: Docker Check
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, '/cmd docker --check --v2')
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.issue.pull_request.head.sha }}
repository: ${{ github.event.repository.full_name }}
- name: Post Initial Status
if: github.event_name == 'issue_comment'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
## 🐳 Docker Check Status
> CI triggered by command `/cmd docker --check --v2`.

**Status:** ⏳ **Building**... Preparing environment and running Docker health checks.
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Run docker compose
working-directory: ./template/nest-next
run: docker compose -f docker-compose-ci.yaml up -d

- name: Wait Service
working-directory: ./template/nest-next
run: |
timeout 60 bash -c '
until [[ "$(docker compose -f docker-compose-ci.yaml ps --services --filter "status=running" | wc -l)" -ge 1 ]]; do
sleep 2
done
'

- name: Send HealthCheck Request
run: curl -k --retry 20 --retry-delay 5 --retry-all-errors -f http://localhost:3000/healthCheck

- name: Update Status on Failure
if: failure() && github.event_name == 'issue_comment'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
## ❌ Docker Check Status FAILED
> CI triggered by command `/cmd docker --check --v2`.

**Status:** **FAILURE!** The service failed to start or did not pass the health check.

[查看完整的 CI 运行日志](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
- name: Check service logs
if: failure()
working-directory: ./template/nest-next
run: docker compose -f docker-compose-ci.yaml logs back
- name: Update Status on Success
if: success() && github.event_name == 'issue_comment'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
## ✅ Docker Check Status
> CI triggered by command `/cmd docker --check`.

**Status:** **SUCCESS!** Service is built, running, and responded to health check on `http://localhost:3000/healthCheck`.
- name: Shutdown Service
working-directory: ./template/nest-next
run: docker compose -f docker-compose-ci.yaml down

docker-check:
name: Docker Check
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Lua.runtime.version": "Lua 5.1",
"Lua.diagnostics.globals": [
"redis",
"KEYS",
"ARGV"
]
}
Loading
Loading