gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: misc: Update Change-Id Check

MJ
Melissa Jost (Gerrit)
Mon, Jul 10, 2023 7:21 PM

Melissa Jost has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/72219?usp=email )

Change subject: misc: Update Change-Id Check
......................................................................

misc: Update Change-Id Check

This updates the change-id code to refer to commit messages in
pull requests instead of on pushes.

Change-Id: I308f02b4616804b386140d5875a79878eccd721e

M .github/workflows/ci-tests.yaml
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci-tests.yaml
b/.github/workflows/ci-tests.yaml
index 61ba4b5..83a1b87 100644
--- a/.github/workflows/ci-tests.yaml
+++ b/.github/workflows/ci-tests.yaml
@@ -16,10 +16,30 @@
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0

  • ensures we have a change-id in every commit, needed for gerrit

  • check-for-change-id:
  • runs on github hosted runner

  • steps:
  •  - uses: actions/checkout@v3
    
  •    with:
    
  •      fetch-depth: 0
    
  •  - name: Check for Change-Id
    
  •    run: |
    
  •      for commit in $(git rev-list ${{  
    

github.event.pull_request.base.sha }}..${{
github.event.pull_request.head.sha }}); do

  •          git checkout $commit
    
  •          if !(git log -1 --pretty=format:"%s" | grep -q "Change-Id: ")
    
  •          then
    
  •            echo "One or more of the commits in this pull request is  
    

missing a Change-ID, which we require for any changes made to gem5. "\

  •            "To automatically insert one, run the following:\n f=`git  
    

rev-parse --git-dir`/hooks/commit-msg ; mkdir -p $(dirname $f) ; "\

  •            "curl -Lo $f  
    

https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x
$f\n Then amend the commit with git commit --amend --no-edit, and update
your pull request."

  •            exit 1
    
  •          fi
    
  •      done
    
  • build-gem5:
    runs-on: [self-hosted, linux, x64, build]
    container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
  • needs: pre-commit # only runs if pre-commit passes
  • needs: [pre-commit, check-for-change-id] # only runs if pre-commit and
    change-id passes
    outputs:
    artifactname: ${{ steps.name.outputs.test }}
    steps:
    @@ -39,7 +59,7 @@
    unittests-all-opt:
    runs-on: [self-hosted, linux, x64, run]
    container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
  • needs: pre-commit # only runs if pre-commit passes
  • needs: [pre-commit, check-for-change-id] # only runs if pre-commit and
    change-id passes
    timeout-minutes: 60
    steps:
    • uses: actions/checkout@v3
      @@ -51,7 +71,7 @@
      testlib-quick:
      runs-on: [self-hosted, linux, x64, run]
      container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
  • needs: [pre-commit, build-gem5]
  • needs: [pre-commit, build-gem5, check-for-change-id]
    timeout-minutes: 360    # 6 hours
    steps:
    • uses: actions/checkout@v3

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/72219?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I308f02b4616804b386140d5875a79878eccd721e
Gerrit-Change-Number: 72219
Gerrit-PatchSet: 1
Gerrit-Owner: Melissa Jost melissakjost@gmail.com

Melissa Jost has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/72219?usp=email ) Change subject: misc: Update Change-Id Check ...................................................................... misc: Update Change-Id Check This updates the change-id code to refer to commit messages in pull requests instead of on pushes. Change-Id: I308f02b4616804b386140d5875a79878eccd721e --- M .github/workflows/ci-tests.yaml 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index 61ba4b5..83a1b87 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -16,10 +16,30 @@ - uses: actions/setup-python@v3 - uses: pre-commit/action@v3.0.0 + # ensures we have a change-id in every commit, needed for gerrit + check-for-change-id: + # runs on github hosted runner + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Check for Change-Id + run: | + for commit in $(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}); do + git checkout $commit + if !(git log -1 --pretty=format:"%s" | grep -q "Change-Id: ") + then + echo "One or more of the commits in this pull request is missing a Change-ID, which we require for any changes made to gem5. "\ + "To automatically insert one, run the following:\n f=`git rev-parse --git-dir`/hooks/commit-msg ; mkdir -p $(dirname $f) ; "\ + "curl -Lo $f https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x $f\n Then amend the commit with git commit --amend --no-edit, and update your pull request." + exit 1 + fi + done + build-gem5: runs-on: [self-hosted, linux, x64, build] container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest - needs: pre-commit # only runs if pre-commit passes + needs: [pre-commit, check-for-change-id] # only runs if pre-commit and change-id passes outputs: artifactname: ${{ steps.name.outputs.test }} steps: @@ -39,7 +59,7 @@ unittests-all-opt: runs-on: [self-hosted, linux, x64, run] container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest - needs: pre-commit # only runs if pre-commit passes + needs: [pre-commit, check-for-change-id] # only runs if pre-commit and change-id passes timeout-minutes: 60 steps: - uses: actions/checkout@v3 @@ -51,7 +71,7 @@ testlib-quick: runs-on: [self-hosted, linux, x64, run] container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest - needs: [pre-commit, build-gem5] + needs: [pre-commit, build-gem5, check-for-change-id] timeout-minutes: 360 # 6 hours steps: - uses: actions/checkout@v3 -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/72219?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I308f02b4616804b386140d5875a79878eccd721e Gerrit-Change-Number: 72219 Gerrit-PatchSet: 1 Gerrit-Owner: Melissa Jost <melissakjost@gmail.com>