diff --git a/.github/workflows/pr_master_test.yml b/.github/workflows/pr_master_test.yml index d6211b0..b25fc92 100644 --- a/.github/workflows/pr_master_test.yml +++ b/.github/workflows/pr_master_test.yml @@ -18,7 +18,7 @@ env: coverage xlrd jobs: - pyomo-tests: + build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.NAME }} runs-on: ${{ matrix.os }} strategy: @@ -174,9 +174,9 @@ jobs: CODECOV_NAME: ${{matrix.TARGET}}/${{matrix.python}}${{matrix.NAME}} run: | [ ! -d ${GITHUB_WORKSPACE}/cache/download ] && mkdir -pv ${GITHUB_WORKSPACE}/cache/download + coverage combine || echo "Nothing to combine." coverage report -i coverage xml -i - ls -la set +e # Always attempt to update the codecov script, but fall back on # the previously cached script if it fails @@ -191,18 +191,54 @@ jobs: echo "Pausing $DELAY seconds before re-attempting download" sleep $DELAY done - ls -la ${GITHUB_WORKSPACE}/cache/ i=0 while : ; do ((i+=1)) echo "Uploading coverage to codecov (attempt ${i})" bash $CODECOV -Z -X gcov -X s3 -f coverage.xml if test $? == 0; then + echo "PASS" > ${GITHUB_WORKSPACE}/codecov.result + break + elif test $i -ge 2; then + # Do not fail the build just because the codecov upload fails + echo "FAIL" > ${GITHUB_WORKSPACE}/codecov.result break - elif test $i -ge 5; then - exit 1 fi DELAY=$(( RANDOM % 30 + 30)) echo "Pausing $DELAY seconds before re-attempting upload" sleep $DELAY done + + - name: Record build artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{github.job}}_${{env.GHA_JOBNAME}} + path: | + codecov.result + # In general, do not record test results as artifacts to + # manage total artifact storage + # TEST-*.xml + + post: + name: post-build + needs: build + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + path: artifacts + + - name: Check codecov upload success + run: | + FAIL=`grep FAIL artifacts/*/codecov.result | wc -l` + ALL=`ls -1 artifacts/*/codecov.result | wc -l` + # Fail is more than 1/9 codecov uploads fail + echo "$FAIL of $ALL codecov uploads failed" + if test $FAIL -gt 0; then + grep FAIL artifacts/*/codecov.result | sed 's/^/ /' + if test $(( $FAIL * 9 )) -gt $ALL; then + echo "More than 1/9 codecov uploads failed:" + exit 1 + fi + fi