From 6afc3fd3dc056e6aef9460a4b5961f3c45416da5 Mon Sep 17 00:00:00 2001 From: Edwin Lu Date: Thu, 23 May 2024 15:40:29 -0700 Subject: [PATCH 1/4] move cache uploading to separate workflow --- .github/actions/checkout-gcc-hash/action.yaml | 33 +++++ .github/workflows/create-cache.yaml | 117 ++++++++++++++++++ .github/workflows/lint.yaml | 19 ++- .github/workflows/patchworks.yaml | 67 +++++++++- .github/workflows/run-checks.yaml | 29 +++-- .github/workflows/test-regression.yaml | 80 +++++++++--- 6 files changed, 312 insertions(+), 33 deletions(-) create mode 100644 .github/actions/checkout-gcc-hash/action.yaml create mode 100644 .github/workflows/create-cache.yaml diff --git a/.github/actions/checkout-gcc-hash/action.yaml b/.github/actions/checkout-gcc-hash/action.yaml new file mode 100644 index 0000000..f21723c --- /dev/null +++ b/.github/actions/checkout-gcc-hash/action.yaml @@ -0,0 +1,33 @@ +name: "Checkout gcc hash" +description: "Checks out gcc hash with retries" +inputs: + hash: + description: 'hash to checkout to' + required: true + +runs: + using: "composite" + steps: + - name: Checkout hash + shell: bash + working-directory: ./riscv-gnu-toolchain + id: pull + run: | + cd gcc + git checkout master + git pull + git checkout ${{ inputs.hash }} + continue-on-error: true + + - name: Sleep and retry + shell: bash + working-directory: ./riscv-gnu-toolchain + if: ${{ steps.pull.outcome == 'failure' }} + run: | + echo "Failed to checkout and pull gcc. Retrying in 1 min" + sleep 60 + cd gcc + git checkout master + git pull + git checkout ${{ inputs.hash }} + diff --git a/.github/workflows/create-cache.yaml b/.github/workflows/create-cache.yaml new file mode 100644 index 0000000..0d9dd5b --- /dev/null +++ b/.github/workflows/create-cache.yaml @@ -0,0 +1,117 @@ +name: Create-Cache + +on: + schedule: + # Run at 1:07 on mondays and fridays + # https://stackoverflow.com/questions/59560214/github-action-works-on-push-but-not-scheduled + - cron: 7 1 * * 1,5 + push: + branches: + - main + +jobs: + init-submodules: + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: riscv-gnu-toolchain + + steps: + - uses: actions/checkout@v3 + + - name: Setup env + uses: ./.github/actions/common/setup-env + with: + free_up_space: false + + - name: Retrieve cache + id: retrieve-cache + uses: actions/cache@v3 + with: + path: | + riscv-gnu-toolchain/.git + riscv-gnu-toolchain/binutils + riscv-gnu-toolchain/dejagnu + riscv-gnu-toolchain/gcc + riscv-gnu-toolchain/gdb + riscv-gnu-toolchain/glibc + riscv-gnu-toolchain/newlib + riscv-gnu-toolchain/qemu + key: submodules-archive-9 # Numbered archive to allow for easy transition when bumping submodules + + - name: Initalize submodules cache + id: cache-init + if: steps.retrieve-cache.outputs.cache-hit != 'true' + run: | + git submodule update --init --recursive --depth 1 binutils + git submodule update --init --recursive --depth 1 dejagnu + git submodule update --init --recursive --depth 1 gdb + git submodule update --init --recursive --depth 1 glibc + git submodule update --init --recursive --depth 1 newlib + git submodule update --init --recursive --depth 1 qemu + continue-on-error: true + + - name: Initalize submodules cache + if: steps.cache-init.outcome == 'failure' + run: | + echo "Failed to initialize cache submodules. Retrying in 1 min" + sleep 60 + git submodule update --init --recursive --depth 1 binutils + git submodule update --init --recursive --depth 1 dejagnu + git submodule update --init --recursive --depth 1 gdb + git submodule update --init --recursive --depth 1 glibc + git submodule update --init --recursive --depth 1 newlib + git submodule update --init --recursive --depth 1 qemu + + - name: Initialize gcc + if: steps.retrieve-cache.outputs.cache-hit != 'true' + id: gcc-cache + uses: ./.github/actions/common/init-and-pull-gcc + with: + init: true + + # Does not remove and reclone gcc if we hit cache + - name: Checkout GCC + if: steps.gcc-cache.outcome == 'skipped' + uses: ./.github/actions/common/init-and-pull-gcc + with: + init: false + + - name: Apply newlib fixups + if: steps.retrieve-cache.outputs.cache-hit != 'true' + run: | + cd newlib + git config --global user.email "github-bot@example.com" + git config --global user.name "Github Bot" + git am ../fixups/newlib/*.patch + + - name: Cache submodules + if: steps.retrieve-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + riscv-gnu-toolchain/.git + riscv-gnu-toolchain/binutils + riscv-gnu-toolchain/dejagnu + riscv-gnu-toolchain/gcc + riscv-gnu-toolchain/gdb + riscv-gnu-toolchain/glibc + riscv-gnu-toolchain/newlib + riscv-gnu-toolchain/qemu + key: submodules-archive-9 + + - name: Make cache zip + run: | + zip -r cache.zip .git binutils dejagnu gcc gdb glibc newlib qemu + + # Use artifact rather than cache since cache downloads are flaky/hang. + # Artifacts are reliable but ~30 min slower to set up. + # Setup is done on one runner, so this isn't a show stopper. + - name: Upload git cache + uses: actions/upload-artifact@v3 + with: + name: gcc-sources + path: | + riscv-gnu-toolchain/cache.zip + retention-days: 5 + diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6b89428..fe11ba6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -36,11 +36,22 @@ jobs: with: free_up_space: false + - name: Bump pyopenssl and crypto + run: | + sudo apt remove python3-pip + wget https://bootstrap.pypa.io/get-pip.py + sudo python3 get-pip.py + pip install -U pyopenssl cryptography + pip install pygithub==1.59.1 requests + - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | diff --git a/.github/workflows/patchworks.yaml b/.github/workflows/patchworks.yaml index c727c4e..da94769 100644 --- a/.github/workflows/patchworks.yaml +++ b/.github/workflows/patchworks.yaml @@ -134,13 +134,72 @@ jobs: outputs: list_of_patch_names: ${{ steps.list_patches.outputs.patch_list }} + init-submodules: needs: [fetch_patches] if: ${{ needs.fetch_patches.outputs.list_of_patch_names != '[]' }} - uses: ./.github/workflows/init-submodules.yaml - with: - baseline_hash: ${{ inputs.baseline_gcc_hash }} - tot_hash: ${{ inputs.tip_of_tree_hash }} + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: riscv-gnu-toolchain + + steps: + - uses: actions/checkout@v3 + + - name: Setup env + uses: ./.github/actions/common/setup-env + with: + free_up_space: false + + - name: Determine baseline + id: baseline-hash + run: | + python ./scripts/get_baseline_hash.py -token ${{ secrets.GITHUB_TOKEN }} + + if [ '${{ inputs.baseline_gcc_hash }}' == '' ] ; then export BASELINE_HASH=$(cat baseline.txt); else export BASELINE_HASH=${{ inputs.baseline_gcc_hash }}; fi + echo $BASELINE_HASH + echo "baseline_hash=$BASELINE_HASH" >> $GITHUB_OUTPUT + + # https://stackoverflow.com/questions/24750215/getting-the-last-commit-hash-from-a-remote-repo-without-cloning + - name: Determine tip-of-tree hash + id: tot-hash + run: | + if [ '${{ inputs.tip_of_tree_hash }}' == '' ]; + then + export TOT_HASH=$(git ls-remote https://gcc.gnu.org/git/gcc.git HEAD | awk '{ print $1 }') + else + export TOT_HASH=${{ inputs.tip_of_tree_hash }} + fi + echo $TOT_HASH + echo "tot_hash=$TOT_HASH" >> $GITHUB_OUTPUT + continue-on-error: true + + - name: Determine tip-of-tree-hash retry + id: tot-retry + if: ${{ steps.tot-hash.outcome == 'failure' }} + run: | + # No need to see if inputs.tip_of_tree_hash is empty string since the only way we'll enter + # this step is if we get an error from the git ls-remote command + echo "retrying to get tip of tree hash due to git error" + sleep 60 + export TOT_HASH=$(git ls-remote https://gcc.gnu.org/git/gcc.git HEAD | awk '{ print $1 }') + echo $TOT_HASH + echo "tot_hash=$TOT_HASH" >> $GITHUB_OUTPUT + + - name: Effective tip-of-tree-hash + id: etot-hash + run: | + if [ '${{ steps.tot-hash.outputs.tot_hash }}' == '' ]; + then + echo "tot_hash=${{ steps.tot-retry.outputs.tot_hash }}" >> $GITHUB_OUTPUT + else + echo "tot_hash=${{ steps.tot-hash.outputs.tot_hash }}" >> $GITHUB_OUTPUT + fi + + outputs: + baseline_hash: ${{ steps.baseline-hash.outputs.baseline_hash }} + tot_hash: ${{ steps.etot-hash.outputs.tot_hash }} + patch_matrix: needs: [fetch_patches, init-submodules] diff --git a/.github/workflows/run-checks.yaml b/.github/workflows/run-checks.yaml index 962b1c2..9cf64ae 100644 --- a/.github/workflows/run-checks.yaml +++ b/.github/workflows/run-checks.yaml @@ -209,11 +209,22 @@ jobs: with: free_up_space: false + - name: Bump pyopenssl and crypto + run: | + sudo apt remove python3-pip + wget https://bootstrap.pypa.io/get-pip.py + sudo python3 get-pip.py + pip install -U pyopenssl cryptography + pip install pygithub==1.59.1 requests + - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | @@ -221,6 +232,11 @@ jobs: unzip cache.zip rm -rf cache.zip + - name: Checkout gcc hash + uses: ./.github/actions/checkout-gcc-hash + with: + hash: ${{ inputs.baseline_hash }} + - name: Download patches artifact uses: actions/download-artifact@v3 with: @@ -231,11 +247,6 @@ jobs: run: | unzip ${{ inputs.patch_name }}-downloaded-patches.zip - - name: Checkout gcc hash - run: | - cd gcc - git checkout ${{ inputs.baseline_hash }} - - name: Apply patches to baseline id: apply-baseline run: | diff --git a/.github/workflows/test-regression.yaml b/.github/workflows/test-regression.yaml index 83178b9..18e4558 100644 --- a/.github/workflows/test-regression.yaml +++ b/.github/workflows/test-regression.yaml @@ -59,11 +59,22 @@ jobs: with: free_up_space: true + - name: Bump pyopenssl and crypto + run: | + sudo apt remove python3-pip + wget https://bootstrap.pypa.io/get-pip.py + sudo python3 get-pip.py + pip install -U pyopenssl cryptography + pip install pygithub==1.59.1 requests + - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | @@ -71,6 +82,11 @@ jobs: unzip cache.zip rm -rf cache.zip + - name: Checkout gcc hash + uses: ./.github/actions/checkout-gcc-hash + with: + hash: ${{ inputs.baseline_hash }} + - name: Extract and apply patches uses: ./.github/actions/extract-apply-patches-trunk-or-baseline with: @@ -156,11 +172,22 @@ jobs: with: free_up_space: true + - name: Bump pyopenssl and crypto + run: | + sudo apt remove python3-pip + wget https://bootstrap.pypa.io/get-pip.py + sudo python3 get-pip.py + pip install -U pyopenssl cryptography + pip install pygithub==1.59.1 requests + - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | @@ -168,6 +195,11 @@ jobs: unzip cache.zip rm -rf cache.zip + - name: Checkout gcc hash + uses: ./.github/actions/checkout-gcc-hash + with: + hash: ${{ inputs.baseline_hash }} + - name: Extract and apply patches uses: ./.github/actions/extract-apply-patches-trunk-or-baseline with: @@ -273,10 +305,13 @@ jobs: free_up_space: false - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | @@ -284,6 +319,11 @@ jobs: unzip cache.zip rm -rf cache.zip + - name: Checkout gcc hash + uses: ./.github/actions/checkout-gcc-hash + with: + hash: ${{ inputs.baseline_hash }} + - name: Extract and apply patches uses: ./.github/actions/extract-apply-patches-trunk-or-baseline with: @@ -367,10 +407,13 @@ jobs: free_up_space: false - name: Restore submodules from cache - uses: actions/download-artifact@v3 - with: - name: gcc-sources-${{ inputs.baseline_hash }} - path: ./riscv-gnu-toolchain + run: | + mkdir temp + python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ + # using download_artifact.py the downloaded file is zipped twice for whatever reason + # remove the first layer of zip files + unzip gcc-sources + rm -rf gcc-sources - name: Restore submodules run: | @@ -378,6 +421,11 @@ jobs: unzip cache.zip rm -rf cache.zip + - name: Checkout gcc hash + uses: ./.github/actions/checkout-gcc-hash + with: + hash: ${{ inputs.baseline_hash }} + - name: Extract and apply patches uses: ./.github/actions/extract-apply-patches-trunk-or-baseline with: From e133a44319d0e634e63448de9603237360acf02c Mon Sep 17 00:00:00 2001 From: Edwin Lu <139795686+ewlu@users.noreply.github.com> Date: Tue, 28 May 2024 10:12:05 -0700 Subject: [PATCH 2/4] generate new cache on pull request --- .github/workflows/create-cache.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-cache.yaml b/.github/workflows/create-cache.yaml index 0d9dd5b..658d413 100644 --- a/.github/workflows/create-cache.yaml +++ b/.github/workflows/create-cache.yaml @@ -5,7 +5,7 @@ on: # Run at 1:07 on mondays and fridays # https://stackoverflow.com/questions/59560214/github-action-works-on-push-but-not-scheduled - cron: 7 1 * * 1,5 - push: + pull_request: branches: - main From 6ff8669a7a505396aafceea5913965a627830eb3 Mon Sep 17 00:00:00 2001 From: Edwin Lu Date: Tue, 28 May 2024 17:58:55 -0700 Subject: [PATCH 3/4] create venv every time --- .../download-comparison-artifacts/action.yaml | 7 ++- .github/workflows/call-patchworks-api.yaml | 58 ++++++++++--------- .github/workflows/downtime-runner.yaml | 24 ++++---- .../workflows/generate-precommit-summary.yaml | 27 +++++---- .github/workflows/issue-closer.yaml | 11 ++-- .github/workflows/lint.yaml | 13 +++-- .github/workflows/run-checks.yaml | 13 +++-- .github/workflows/test-regression.yaml | 45 ++++++++++---- 8 files changed, 119 insertions(+), 79 deletions(-) diff --git a/.github/actions/common/download-comparison-artifacts/action.yaml b/.github/actions/common/download-comparison-artifacts/action.yaml index d67a4f3..42e25a7 100644 --- a/.github/actions/common/download-comparison-artifacts/action.yaml +++ b/.github/actions/common/download-comparison-artifacts/action.yaml @@ -25,7 +25,11 @@ runs: if: ${{ !cancelled() && hashFiles(format('./current_logs/{0}', inputs.report-artifact-name)) == '' }} shell: bash run: | - pip install pygithub requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests cd riscv-gnu-toolchain python ./scripts/download_artifact.py -name ${{ inputs.report-artifact-name }} -repo ${{ inputs.repo }} -token ${{ inputs.github-token }} -outdir current_logs continue-on-error: true @@ -42,6 +46,7 @@ runs: if: ${{ !cancelled() && hashFiles(format('./current_logs/{0}', inputs.report-artifact-name)) == '' && hashFiles(format('./temp/{0}', inputs.binary-artifact-name)) == '' }} shell: bash run: | + source venv/bin/activate cd riscv-gnu-toolchain python ./scripts/download_artifact.py -name ${{ inputs.binary-artifact-name }} -repo ${{ inputs.repo }} -token ${{ inputs.github-token }} -outdir temp continue-on-error: true diff --git a/.github/workflows/call-patchworks-api.yaml b/.github/workflows/call-patchworks-api.yaml index 607a934..0129e74 100644 --- a/.github/workflows/call-patchworks-api.yaml +++ b/.github/workflows/call-patchworks-api.yaml @@ -20,14 +20,6 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto - run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests - - name: Get patch-name id: patch-name run: | @@ -50,9 +42,18 @@ jobs: echo "check=$CHECK" >> $GITHUB_OUTPUT echo "context=$CONTEXT" >> $GITHUB_OUTPUT + - name: Setup python env + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests + - name: Download patch run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name ${{ steps.patch-name.outputs.patch_name }}-downloaded-patches -repo "ewlu/gcc-precommit-ci" -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ - name: Extract patch @@ -64,7 +65,8 @@ jobs: id: patch-id run: | export PATCH_ID=$(tail -n 1 ./patches/${{ steps.patch-name.outputs.patch_name }}) - echo $PATCH_ID + echo $PATCH_ID1.59.1 requests + echo "patch_id=$PATCH_ID" >> $GITHUB_OUTPUT outputs: @@ -89,13 +91,13 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Report pass run: | @@ -119,16 +121,17 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Report Warning run: | + source venv/bin/activate python scripts/post_check_to_patchworks.py -event ${{ github.event_name }} -repo ewlu/gcc-precommit-ci -pid ${{ needs.get-patch-info.outputs.patch_id }} -desc '${{ needs.get-patch-info.outputs.check }} warning' -iid ${{ github.event.issue.number }} -state 'warning' -context '${{ needs.get-patch-info.outputs.context }}' -token ${{ secrets.PATCHWORK_API }} @@ -148,13 +151,14 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests + - name: Report Error run: | diff --git a/.github/workflows/downtime-runner.yaml b/.github/workflows/downtime-runner.yaml index a47db93..e1a48bc 100644 --- a/.github/workflows/downtime-runner.yaml +++ b/.github/workflows/downtime-runner.yaml @@ -26,18 +26,19 @@ jobs: sudo apt install python-is-python3 -y sudo apt install zip -y - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Download last successful run artifact run: | - pip install pygithub requests mkdir result mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name "downtime_runner_success" -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir result || true ls result @@ -96,12 +97,13 @@ jobs: sudo apt install python-is-python3 -y sudo apt install zip -y - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip -y - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Get Timestamps run: | diff --git a/.github/workflows/generate-precommit-summary.yaml b/.github/workflows/generate-precommit-summary.yaml index 60512c2..1f259e2 100644 --- a/.github/workflows/generate-precommit-summary.yaml +++ b/.github/workflows/generate-precommit-summary.yaml @@ -73,17 +73,18 @@ jobs: mkdir temp mkdir summaries - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Download baseline sum files run: | # Download linux + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-linux-rv64gcv-lp64d-${{ inputs.baseline_hash }}-multilib-sum-files -repo patrick-rivos/gcc-postcommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./temp python ./scripts/download_artifact.py -name gcc-linux-rv64gc_zba_zbb_zbc_zbs-lp64d-${{ inputs.baseline_hash }}-non-multilib-sum-files -repo patrick-rivos/gcc-postcommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./temp python ./scripts/download_artifact.py -name gcc-linux-rv32gc_zba_zbb_zbc_zbs-ilp32d-${{ inputs.baseline_hash }}-non-multilib-sum-files -repo patrick-rivos/gcc-postcommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./temp @@ -246,14 +247,18 @@ jobs: name: ${{ needs.compare-artifacts.outputs.baseline_hash }}-previous-logs path: ./riscv-gnu-toolchain + - name: Setup python env + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests + - name: Download patches artifact if: ${{ needs.compare-artifacts.outputs.workflow_dispatch == 'true' }} run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography pygithub==1.59.1 requests - mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name ${{ inputs.patch_name }}-downloaded-patches -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./temp -repo ewlu/gcc-precommit-ci ls temp unzip temp/${{ inputs.patch_name }}-downloaded-patches diff --git a/.github/workflows/issue-closer.yaml b/.github/workflows/issue-closer.yaml index c3ff4c6..26e8056 100644 --- a/.github/workflows/issue-closer.yaml +++ b/.github/workflows/issue-closer.yaml @@ -28,12 +28,13 @@ jobs: sudo apt install python-is-python3 -y sudo apt install zip -y - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Close issues run: | diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index fe11ba6..4f981ec 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -36,17 +36,18 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files diff --git a/.github/workflows/run-checks.yaml b/.github/workflows/run-checks.yaml index 9cf64ae..cbce91f 100644 --- a/.github/workflows/run-checks.yaml +++ b/.github/workflows/run-checks.yaml @@ -209,17 +209,18 @@ jobs: with: free_up_space: false - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files diff --git a/.github/workflows/test-regression.yaml b/.github/workflows/test-regression.yaml index 18e4558..20e9963 100644 --- a/.github/workflows/test-regression.yaml +++ b/.github/workflows/test-regression.yaml @@ -59,17 +59,18 @@ jobs: with: free_up_space: true - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files @@ -172,17 +173,18 @@ jobs: with: free_up_space: true - - name: Bump pyopenssl and crypto + - name: Setup python env run: | - sudo apt remove python3-pip - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py - pip install -U pyopenssl cryptography - pip install pygithub==1.59.1 requests + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files @@ -304,9 +306,18 @@ jobs: with: free_up_space: false + - name: Setup python env + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests + - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files @@ -406,9 +417,19 @@ jobs: with: free_up_space: false + - name: Setup python env + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -U pyopenssl cryptography + python -m pip install pygithub==1.59.1 requests + + - name: Restore submodules from cache run: | mkdir temp + source venv/bin/activate python ./scripts/download_artifact.py -name gcc-sources -repo ewlu/gcc-precommit-ci -token ${{ secrets.GITHUB_TOKEN }} -outdir ./ # using download_artifact.py the downloaded file is zipped twice for whatever reason # remove the first layer of zip files From 59b8123708f53ed5878aada4dbe17bdd8acac392 Mon Sep 17 00:00:00 2001 From: Edwin Lu Date: Thu, 30 May 2024 15:27:19 -0700 Subject: [PATCH 4/4] update submodule archive and chron job scheduling --- .github/workflows/create-cache.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create-cache.yaml b/.github/workflows/create-cache.yaml index 658d413..e05bea3 100644 --- a/.github/workflows/create-cache.yaml +++ b/.github/workflows/create-cache.yaml @@ -2,12 +2,9 @@ name: Create-Cache on: schedule: - # Run at 1:07 on mondays and fridays + # Run at 1:07 on sundays # https://stackoverflow.com/questions/59560214/github-action-works-on-push-but-not-scheduled - - cron: 7 1 * * 1,5 - pull_request: - branches: - - main + - cron: 7 1 * * 0 jobs: init-submodules: @@ -37,7 +34,7 @@ jobs: riscv-gnu-toolchain/glibc riscv-gnu-toolchain/newlib riscv-gnu-toolchain/qemu - key: submodules-archive-9 # Numbered archive to allow for easy transition when bumping submodules + key: submodules-archive-10 # Numbered archive to allow for easy transition when bumping submodules - name: Initalize submodules cache id: cache-init @@ -98,7 +95,7 @@ jobs: riscv-gnu-toolchain/glibc riscv-gnu-toolchain/newlib riscv-gnu-toolchain/qemu - key: submodules-archive-9 + key: submodules-archive-10 - name: Make cache zip run: | @@ -113,5 +110,5 @@ jobs: name: gcc-sources path: | riscv-gnu-toolchain/cache.zip - retention-days: 5 + retention-days: 9