ci: add PR validation workflow with Conventional Commits check
Some checks failed
Pull Request Validation / validate-pr-title (pull_request) Has been cancelled
Pull Request Validation / validate-docker (pull_request) Has been cancelled
Pull Request Validation / build-test (pull_request) Has been cancelled
Pull Request Validation / check-files (pull_request) Has been cancelled

- Add .gitea/workflows/pr-validation.yml with 4 validation jobs
- Validate PR titles follow Conventional Commits format
- Check Dockerfile and nginx.conf syntax
- Run integration tests (build image, test container, verify pages load)
- Verify required files exist and HTTrack artifacts excluded
- Update copilot-instructions.md with PR validation details
This commit is contained in:
Pat Teruel
2025-12-30 21:24:27 +08:00
parent d6d3fe4d7f
commit 499d44ba38
2 changed files with 216 additions and 2 deletions

View File

@@ -76,13 +76,31 @@ docker tag karaokepedia:latest your-registry/karaokepedia:latest
docker push your-registry/karaokepedia:latest
```
### CI/CD Pipeline (Gitea Actions)
### CI/CD Pipelines (Gitea Actions)
#### Build & Deploy (`.gitea/workflows/build.yml`)
- **Trigger**: Push to `main` branch or manual dispatch
- **Workflow**: `.gitea/workflows/build.yml` (GitHub Actions-compatible syntax)
- **Steps**: Checkout → Setup Buildx → Login to registry → Build & push → Output digest
- **Tags**: `:latest` and `:main-<commit-sha>`
- **Registry**: Configure via secrets (DOCKER_USERNAME/DOCKER_PASSWORD for Docker Hub, or adapt for Gitea registry)
#### PR Validation (`.gitea/workflows/pr-validation.yml`)
- **Trigger**: Pull request opened, edited, synchronized, or reopened
- **Jobs**:
- `validate-pr-title`: Enforces [Conventional Commits](https://www.conventionalcommits.org/) format
- `validate-docker`: Checks Dockerfile, nginx.conf, and .dockerignore syntax
- `build-test`: Builds image and tests container starts, pages load, assets accessible
- `check-files`: Verifies required files exist, HTTrack artifacts excluded
**Conventional Commit Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci`, `build`, `revert`
**Example PR titles**:
-`feat: add user authentication`
-`fix(docker): correct nginx config path`
-`docs: update README with deployment steps`
-`Added new feature` (missing type)
-`Update files` (not descriptive)
### Registry Configuration
Edit `.gitea/workflows/build.yml` and uncomment the appropriate registry:
- **Docker Hub** (default): Uses `DOCKER_USERNAME` and `DOCKER_PASSWORD` secrets