π·(ci) add dev and notebook ci workflows #9
Workflow file for this run
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: Pull Request Validation | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| types: [ opened, synchronize, reopened ] | |
| jobs: | |
| commit-format: | |
| name: Check Commit Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.head_ref }} # Checkout the PR branch without merging | |
| - name: Check single commit and format | |
| run: | | |
| # Get all PR commits | |
| BASE_SHA=$(git merge-base origin/main HEAD) | |
| COMMITS=$(git rev-list --reverse $BASE_SHA..HEAD) | |
| echo "Commits in this PR:" | |
| # Commit message schema regex | |
| SCHEMA_REGEX="^(π¨|β‘οΈ|π₯|π|ποΈ|β¨|π|π|π|π|β |ποΈ|π|π|π¨|π§|π|β¬οΈ|β¬οΈ|π|π·|π|β»οΈ|β|β|π§|π¨|π|βοΈ|π©|βͺοΈ|π|π¦οΈ|π½οΈ|π|π|π₯|π±|βΏοΈ|π‘|π»|π¬|ποΈ|π|π|π₯|πΈ|ποΈ|π±|π€‘|π₯|π|πΈ|βοΈ|ποΈ|π·οΈ|π±|π©|π₯ |π«|ποΈ|π|π©Ή|π§|β°οΈ|π§ͺ|π|π©Ί|π§±|π§βπ»|πΈ|π§΅|π¦Ί|βοΈ)\\([a-z0-9:-]+\\) [a-z].{1,50}" | |
| # Validate commit message schema | |
| INVALID_COMMITS=0 | |
| for commit in $COMMITS; do | |
| MESSAGE=$(git log --format=%s -n 1 $commit) | |
| echo "$MESSAGE" | |
| if ! echo "$MESSAGE" | grep -qE "$SCHEMA_REGEX"; then | |
| echo "β Invalid commit format: $MESSAGE" | |
| INVALID_COMMITS=$((INVALID_COMMITS + 1)) | |
| fi | |
| done | |
| if [ $INVALID_COMMITS -gt 0 ]; then | |
| echo "β $INVALID_COMMITS commit(s) with invalid format detected" | |
| echo "Required format: <emoji>(<scope>) <subject>" | |
| echo "Example: β¨(auth) add support for HTTP basic auth" | |
| exit 1 | |
| fi | |
| echo "β All commits have valid format" | |
| build: | |
| name: Build All Services | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build all services | |
| run: make build | |
| lint: | |
| name: Lint All Services | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build dev image | |
| run: make build-dev | |
| - name: Lint all services | |
| run: make lint |