From 53834c445e65900b946a4ffdfd2de46297b066ab Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Sun, 18 Feb 2024 17:21:43 -0800 Subject: [PATCH] Only fetch submodules in workflows if we actually need them to build --- .github/workflows.src/tests.inc.yml | 32 +++++++++----- .github/workflows/tests-ha.yml | 37 +++++++++------- .github/workflows/tests-managed-pg.yml | 57 ++++++++++--------------- .github/workflows/tests-patches.yml | 37 +++++++++------- .github/workflows/tests-pg-versions.yml | 37 +++++++++------- .github/workflows/tests.yml | 47 ++++++++++---------- 6 files changed, 132 insertions(+), 115 deletions(-) diff --git a/.github/workflows.src/tests.inc.yml b/.github/workflows.src/tests.inc.yml index 482fc83b96a..0af9b03ee06 100644 --- a/.github/workflows.src/tests.inc.yml +++ b/.github/workflows.src/tests.inc.yml @@ -4,11 +4,6 @@ fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -108,9 +103,20 @@ uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -184,11 +190,17 @@ # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions diff --git a/.github/workflows/tests-ha.yml b/.github/workflows/tests-ha.yml index 3120ece6372..3088198db4d 100644 --- a/.github/workflows/tests-ha.yml +++ b/.github/workflows/tests-ha.yml @@ -19,11 +19,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -149,9 +144,20 @@ jobs: uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -225,11 +231,17 @@ jobs: # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions @@ -354,11 +366,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python diff --git a/.github/workflows/tests-managed-pg.yml b/.github/workflows/tests-managed-pg.yml index 6dfad05661e..b17a5b5a99e 100644 --- a/.github/workflows/tests-managed-pg.yml +++ b/.github/workflows/tests-managed-pg.yml @@ -19,11 +19,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -134,9 +129,20 @@ jobs: uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -210,11 +216,17 @@ jobs: # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions @@ -385,11 +397,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -613,11 +620,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -889,11 +891,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -1131,11 +1128,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -1361,11 +1353,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python diff --git a/.github/workflows/tests-patches.yml b/.github/workflows/tests-patches.yml index 48a013d9a54..8586e63987e 100644 --- a/.github/workflows/tests-patches.yml +++ b/.github/workflows/tests-patches.yml @@ -21,11 +21,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -136,9 +131,20 @@ jobs: uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -212,11 +218,17 @@ jobs: # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions @@ -354,11 +366,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python diff --git a/.github/workflows/tests-pg-versions.yml b/.github/workflows/tests-pg-versions.yml index f15cafbace3..e95e631186e 100644 --- a/.github/workflows/tests-pg-versions.yml +++ b/.github/workflows/tests-pg-versions.yml @@ -19,11 +19,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -134,9 +129,20 @@ jobs: uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -210,11 +216,17 @@ jobs: # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions @@ -373,11 +385,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1a743a4071e..631b63d8ac8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,11 +22,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -146,9 +141,20 @@ jobs: uses: actions/cache@v4 id: libpg-query-cache with: - path: edb/pgsql/parser/libpg_query/libpg_query.a + path: build/libpg_query/libpg_query.a key: edb-libpg_query-v1-${{ env.LIBPG_QUERY_GIT_REV }} + - name: Fetch submodules + if: | + steps.ext-cache.outputs.cache-hit != 'true' || + steps.postgres-cache.outputs.cache-hit != 'true' || + steps.libpg-query-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + fetch-depth: 50 + submodules: true + clean: false + # Install system dependencies for building - name: Install system deps @@ -222,11 +228,17 @@ jobs: # Build libpg_query - name: Build libpg_query - if: | - steps.libpg-query-cache.outputs.cache-hit != 'true' && - steps.ext-cache.outputs.cache-hit != 'true' + if: steps.ext-cache.outputs.cache-hit != 'true' + env: + CACHE_HIT: ${{ steps.libpg-query-cache.outputs.cache-hit }} run: | - python setup.py build_libpg_query + if [[ "$CACHE_HIT" != "true" ]]; then + python setup.py build_libpg_query + mkdir -p build/libpg_query + cp edb/pgsql/parser/libpg_query/libpg_query.a build/libpg_query/ + else + cp build/libpg_query/libpg_query.a edb/pgsql/parser/libpg_query/ + fi # Build extensions @@ -351,11 +363,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -437,11 +444,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python @@ -596,11 +598,6 @@ jobs: fetch-depth: 0 submodules: false - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - name: Set up Python uses: actions/setup-python@v5 id: setup-python