From nobody Fri Dec 06 01:08:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y4CnG6qRtz5g0cF; Fri, 06 Dec 2024 01:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4CnG6GNrz4tLF; Fri, 6 Dec 2024 01:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733447314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FlLEo1XKg0FlY6nVq4r1IyFNexZHlV0+Kyq65ecjMaM=; b=vlWTDme4cgx5K9xSKihpbcGSIJufVemJxNHU3+A1B12q5G4YGCGDRv9yO2QKIdcN4y/plk byOzuoh2jP7CAysNHvinnCaFE6iKPkT7SCJhpjz8V+887kKvlTx1vDk9xKLORuut2jVc20 fvlPCj/C0nBcP6+Jau5gqLxqApabfizn/MI58gZJTnvO3/Yocb8iC0h2jsZEcNm0MukW00 X25AeXYF8LlOcpoDodflQc8mKWoNqWS9P5glsd6xzGYztapUMOPPRg/zBgJz6MUmbLNosi 6q2tDF64xmgaJ1jZC0AI1dtAHXarHun7Kz/X16DKBGl8Yqnmx9KznJ/ma55qWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733447314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FlLEo1XKg0FlY6nVq4r1IyFNexZHlV0+Kyq65ecjMaM=; b=pXkN+5lXcLFJ71z876cj5xkawC+TGvRB2zFKVfyAoWX+vfM16CplbVucDfr87KzGKDnmEC xOyhIkd0KCUYMADfYX0yF2ZdUoR6VShCOrlY5X2A7/t8VT+JRTZ9iNCnTmvrUTsEUunS9b 7KaBJrU/ThtTgM2O/pOovpCSNqvKWCC+AmujzuttUoBG2BjX5EnSDZ4WYypDagHt4En9rq vX7ImMuhpgxh1ZvLhnR8/WoXeGznFWVsqhyJuXD925lCriEg9IBMhq8NWsJDfiQfTCIpQ3 H8KTs75Z4gTOpcyWBU9++JxG7JM2yJQ1xosiXXgGIgPxxWBOvUrSXvO8XiB/4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733447314; a=rsa-sha256; cv=none; b=HKPI24UZqxzIYgVsJQHgr2I21/h7wD8yvhC9PrxJ330Ao5YvoxalESpDGNnzONmDSKaT8P bCmvElBPIsJome5rpfOkXsaxwmBWLsYHSarygsjgcQmLMRwAQbfpKn9En7QKJrAfJIk+pm vVZoNFg9yVQ5F3mp1T27t6K5uBeS1nl7q1hF0GtTHk41sULLQedzs0JakT/fXByCVr3FUc +GDSFOxMcpYW+m8rWSmu8hfViQCY65nQaFGxnPVH+k9l8fF4Ysl0cJ2p8wFfO2jc8Upj7y sSy6cTMUGhWy/orJ/ARaQW1Ajh5nIipoUPW2yp+Q95uyq2Z7rDLKcHhrnhK2Rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4CnG5sSlzGTk; Fri, 6 Dec 2024 01:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B618YNN085003; Fri, 6 Dec 2024 01:08:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B618YQK085000; Fri, 6 Dec 2024 01:08:34 GMT (envelope-from git) Date: Fri, 6 Dec 2024 01:08:34 GMT Message-Id: <202412060108.4B618YQK085000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e0231d3cd363 - main - github: optimize style workflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0231d3cd363bb33142270315aa817977b632910 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e0231d3cd363bb33142270315aa817977b632910 commit e0231d3cd363bb33142270315aa817977b632910 Author: Ahmad Khalifa AuthorDate: 2024-12-01 13:42:53 +0000 Commit: Warner Losh CommitDate: 2024-12-06 00:59:51 +0000 github: optimize style workflow Only fetch the commits we need instead of fetching the entire history. Unfortunately there doesn't seem to be a way to add 1 to the number of commits without an extra step, so do it in a new step and pass the information onto $GITHUB_ENV so it can be used later. Signed-off-by: Ahmad Khalifa Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1538 --- .github/workflows/style.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 08d4242df5ed..0e7c1d8ca6d8 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,10 +1,6 @@ name: Style Checker -# Runs my simple style(9) checker on any pushes or pull requests. It could be -# optimized by fetching the pull request head branch back to main revisions and -# running on that. That would reduce the run time from 3-4 minutes down to 30-40 -# seconds. Getting the right series of clone + fetches to get that iteratively -# is proving elusive, so optimizations welcome. +# Runs my simple style(9) checker on pull requests. on: pull_request: # maybe pull_request_target @@ -19,10 +15,15 @@ jobs: name: Style Checker runs-on: ubuntu-latest steps: + # Unfortunately there doesn't seem to be a way to + # do this without an extra step. + - name: Get depth + run: | + echo "DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV - name: checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: ${{ env.DEPTH }} ref: ${{ github.event.pull_request.head.sha }} - name: Install packages run: | @@ -30,5 +31,5 @@ jobs: sudo apt-get -yq --no-install-suggests --no-install-recommends install perl - name: Run checker run: | - sha=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) + sha=$(git rev-parse HEAD~${{ github.event.pull_request.commits }}) tools/build/checkstyle9.pl --github ${sha}..${{ github.event.pull_request.head.sha }}