diff --git a/.commitlintrc.yaml b/.commitlintrc.yaml index d0b32786..67b733c2 100644 --- a/.commitlintrc.yaml +++ b/.commitlintrc.yaml @@ -1,6 +1,6 @@ rules: body-case: [2, always, sentence-case] - body-full-stop: [2, always] + body-full-stop: [1, always] body-leading-blank: [2, always] body-max-line-length: [2, always, 72] footer-leading-blank: [2, always] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9383858b..fa38a79e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: [push, pull_request] jobs: lint-commitlint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -33,10 +33,10 @@ jobs: - name: Check commit message compliance of the pull request if: github.event_name == 'pull_request' run: | - ./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }} + ./run-tests.sh --check-commitlint ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }} lint-shellcheck: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: ./run-tests.sh --check-shellcheck docs-sphinx: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -55,7 +55,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install system dependencies run: sudo apt-get update -y @@ -69,7 +69,7 @@ jobs: run: ./run-tests.sh --check-sphinx format-prettier: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -86,7 +86,7 @@ jobs: run: ./run-tests.sh --check-prettier lint-js: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -103,7 +103,7 @@ jobs: run: ./run-tests.sh --check-lint js-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -120,7 +120,7 @@ jobs: run: ./run-tests.sh --check-js-tests lint-dockerfile: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -129,7 +129,7 @@ jobs: run: ./run-tests.sh --check-dockerfile docker-build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -138,7 +138,7 @@ jobs: run: ./run-tests.sh --check-docker-build release-docker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 if: > vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' && diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1240941f..32f7a2d0 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,9 +7,9 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.8" + python: "3.12" sphinx: configuration: docs/conf.py diff --git a/run-tests.sh b/run-tests.sh index 3916a618..fc7b99fa 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -16,15 +16,28 @@ check_commitlint () { npx commitlint --from="$from" --to="$to" found=0 while IFS= read -r line; do - if echo "$line" | grep -qP "\(\#$pr\)$"; then - true - elif echo "$line" | grep -qP "^chore\(.*\): release"; then - true - else - echo "✖ Headline does not end by '(#$pr)' PR number: $line" + commit_hash=$(echo "$line" | cut -d ' ' -f 1) + commit_title=$(echo "$line" | cut -d ' ' -f 2-) + commit_number_of_parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}') + # (i) skip checking release commits generated by Release Please + if [ "$commit_number_of_parents" -le 1 ] && echo "$commit_title" | grep -qP "^chore\(.*\): release"; then + continue + fi + # (ii) check presence of PR number + if ! echo "$commit_title" | grep -qP "\(\#$pr\)$"; then + echo "✖ Headline does not end by '(#$pr)' PR number: $commit_title" found=1 fi - done < <(git log "$from..$to" --format="%s") + # (iii) check absence of merge commits in feature branches + if [ "$commit_number_of_parents" -gt 1 ]; then + if echo "$commit_title" | grep -qP "^chore\(.*\): merge "; then + break # skip checking maint-to-master merge commits + else + echo "✖ Merge commits are not allowed in feature branches: $commit_title" + found=1 + fi + fi + done < <(git log "$from..$to" --format="%H %s") if [ $found -gt 0 ]; then exit 1 fi