Skip to content

Commit

Permalink
add retry for git related actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlu committed Apr 25, 2024
1 parent 38b4921 commit c6438e3
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 25 deletions.
51 changes: 51 additions & 0 deletions .github/actions/common/init-and-pull-gcc/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Init and setup gcc"
description: "Initializes and pull gcc with retries"
inputs:
init:
description: 'Do (or do not) remove and reclone gcc. Defaults to false'
required: false
default: 'false'

runs:
using: "composite"
steps:
- name: Initialize gcc
shell: bash
working-directory: ./riscv-gnu-toolchain
id: init
if: ${{ inputs.init == 'true' }}
run: |
rm -rf gcc
git clone git://gcc.gnu.org/git/gcc.git
continue-on-error: true

- name: Sleep and retry
shell: bash
working-directory: ./riscv-gnu-toolchain
if: ${{ steps.init.outcome == 'failure' }}
run: |
echo "Failed to clone gcc. Retrying in 1 min"
sleep 60
git clone git://gcc.gnu.org/git/gcc.git
- name: Checkout master
shell: bash
working-directory: ./riscv-gnu-toolchain
id: pull
run: |
cd gcc
git checkout master
git pull
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
11 changes: 11 additions & 0 deletions .github/actions/common/setup-env/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ runs:
using: "composite"
steps:
- name: Initialize riscv-gnu-toolchain
id: init-toolchain
shell: bash
working-directory: ./
run: |
git submodule update --init riscv-gnu-toolchain
continue-on-error: true

- name: Initialize riscv-gnu-toolchain
if: steps.init-toolchain.outcome == 'failure'
shell: bash
working-directory: ./
run: |
echo "Failed to initialize toolchain. Retrying in 1 min"
sleep 60
git submodule update --init riscv-gnu-toolchain
- name: Remove unneeded frameworks to recover disk space
shell: bash
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ jobs:
- name: Checkout gcc hash
run: |
cd gcc
git fetch
echo "using hash $(git rev-parse HEAD)"
- name: Make log name
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/deploy-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ jobs:
free_up_space: false

- name: Initalize gcc
id: init
run: |
cd riscv-gnu-toolchain
git submodule update --init gcc
cd gcc
git fetch
continue-on-error: true

- name: Initalize gcc
if: ${{ steps.init.outcome == 'failure' }}
run: |
echo "Failed to initialize gcc. Retrying in 1 min"
sleep 60
cd riscv-gnu-toolchain
git submodule update --init gcc
cd gcc
git fetch
- name: Bump pyopenssl and crypto
run: |
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/generate-summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,19 @@ jobs:
riscv-gnu-toolchain/qemu
key: submodules-archive-9 # Numbered archive to allow for easy transition when bumping submodules

- name: Initalize gcc
- name: Initialize gcc
if: steps.retrieve-cache.outputs.cache-hit != 'true'
run: |
rm -rf gcc
git clone git://gcc.gnu.org/git/gcc.git
id: gcc-cache
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: true

- name: Pull gcc
id: gcc-hash
run: |
cd gcc
git checkout master
git pull
# 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: Create directories
run: |
Expand Down Expand Up @@ -346,18 +347,19 @@ jobs:
riscv-gnu-toolchain/qemu
key: submodules-archive-9 # Numbered archive to allow for easy transition when bumping submodules

- name: Initalize gcc
- name: Initialize gcc
if: steps.retrieve-cache.outputs.cache-hit != 'true'
run: |
rm -rf gcc
git clone git://gcc.gnu.org/git/gcc.git
id: gcc-cache
uses: ./.github/actions/common/init-and-pull-gcc
with:
init: true

- name: Pull gcc
id: gcc-hash
run: |
cd gcc
git checkout master
git pull
# 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: Initialize Bisection Hash
id: bisection-hash
Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/init-submodules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
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
Expand All @@ -53,8 +54,33 @@ jobs:
git submodule update --init --recursive --depth 1 glibc
git submodule update --init --recursive --depth 1 newlib
git submodule update --init --recursive --depth 1 qemu
rm -rf gcc
git clone git://gcc.gnu.org/git/gcc.git
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'
Expand All @@ -68,8 +94,6 @@ jobs:
working-directory: riscv-gnu-toolchain/gcc
id: gcc-hash
run: |
git checkout master
git pull
if [ "${{ github.event.inputs.gcchash }}" == "" ]; then
export GCCHASH=$(git rev-parse HEAD)
else
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/rvv-intrinsic-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ jobs:
run: sudo ./.github/setup-apt.sh

- name: Clone rvv-intrinsic-doc
id: update-intrinsic
run: |
git submodule update --init rvv-intrinsic-doc
continue-on-error: true

- name: Clone rvv-intrinsic-doc
if: ${{ steps.update-intrinsice.outcome == 'failure' }}
run: |
echo "Failed to update intrinsic doc. Retrying in 1 min"
sleep 60
git submodule update --init rvv-intrinsic-doc
- name: Make check-gcc
run: |
Expand Down

0 comments on commit c6438e3

Please sign in to comment.