You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/01/22 15:49:43 UTC

[airflow] 30/33: Get rid of upload coverage warnings (#20994)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 482977c6d04a3fca789036d01874063357750887
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Thu Jan 20 19:59:18 2022 +0100

    Get rid of upload coverage warnings (#20994)
    
    Because of lack of memory for public runners, we only run
    coverage on our tests in direct push builds in main. However it
    we still attempted to upload partial coverage results as
    artifacts in regular PRs even if the coverage files were missing.
    This generated a lot of warnings in CI jobs (luckliy those warnings
    are not easily visible).
    
    This PR remove upload attempts on non-main builds in Airflow.
    
    (cherry picked from commit 4748276f13f3b455fedbebd448b6aa3272cef2d5)
---
 .github/workflows/ci.yml | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1a038bd..9da2304 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -178,6 +178,7 @@ jobs:
       pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
       pullRequestLabels: ${{ steps.source-run-info.outputs.pullRequestLabels }}
       runsOn: ${{ steps.set-runs-on.outputs.runsOn }}
+      runCoverage: ${{ steps.set-run-coverage.outputs.runCoverage }}
     steps:
       - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
         uses: actions/checkout@v2
@@ -234,6 +235,15 @@ jobs:
             echo "Maintainer or main run running with self-hosted runner"
             echo "::set-output name=runsOn::\"self-hosted\""
           fi
+      # Avoid having to specify the coverage logic every time.
+      - name: Set run coverage
+        id: set-run-coverage
+        run: |
+          echo "::set-output name=runCoverage::true"
+        if: >
+          github.ref == 'refs/heads/main' && github.repository == 'apache/airflow' &&
+          github.event_name == 'push' &&
+          steps.selective-checks.outputs.default-branch == 'main'
 
   tests-ui:
     timeout-minutes: 10
@@ -682,6 +692,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: >
             coverage-helm
@@ -742,6 +753,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: >
             coverage-postgres-${{matrix.python-version}}-${{matrix.postgres-version}}
@@ -801,6 +813,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: coverage-mysql-${{matrix.python-version}}-${{matrix.mysql-version}}
           path: "./files/coverage*.xml"
@@ -859,6 +872,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: coverage-mssql-${{matrix.python-version}}-${{matrix.mssql-version}}
           path: "./files/coverage*.xml"
@@ -915,6 +929,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: coverage-sqlite-${{matrix.python-version}}
           path: ./files/coverage*.xml
@@ -987,6 +1002,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
           retention-days: 7
       - name: "Upload artifact for coverage"
         uses: actions/upload-artifact@v2
+        if: needs.build-info.outputs.runCoverage == 'true'
         with:
           name: coverage-quarantined-${{ matrix.backend }}
           path: "./files/coverage*.xml"
@@ -1007,10 +1023,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
     env:
       RUNS_ON: ${{ fromJson(needs.build-info.outputs.runsOn) }}
     # Only upload coverage on merges to main
-    if: >
-      github.ref == 'refs/heads/main' && github.repository == 'apache/airflow' &&
-      github.event_name == 'push' &&
-      needs.build-info.outputs.default-branch == 'main'
+    if: needs.build-info.outputs.runCoverage == 'true'
     steps:
       - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
         uses: actions/checkout@v2