From ee9c74f55609673f1ffd7536bb2976ab35f974d0 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 16:16:47 -0500 Subject: [PATCH 1/6] GHA: factor out init-pants action call --- .github/actions/init-pants.yaml | 36 +++++++++++++++++++++++++++++++++ .github/workflows/lint.yaml | 18 +---------------- .github/workflows/pants.yaml | 18 +---------------- .github/workflows/test.yaml | 18 +---------------- 4 files changed, 39 insertions(+), 51 deletions(-) create mode 100644 .github/actions/init-pants.yaml diff --git a/.github/actions/init-pants.yaml b/.github/actions/init-pants.yaml new file mode 100644 index 0000000000..6f2fd35dfe --- /dev/null +++ b/.github/actions/init-pants.yaml @@ -0,0 +1,36 @@ +--- +name: Initialize Pants and its GHA caches +description: + Light wrapper around the pantsbuild/actions/init-pants action + to maintain the input vars in only one place for all workflows. + +inputs: + gha-cache-key: + description: Qualify all cache keys with this string. Useful for invalidating everything. + required: true + +runs: + using: "composite" + steps: + - name: Initialize Pants and its GHA caches + uses: pantsbuild/actions/init-pants@v8 + # This action adds an env var to make pants use both pants.ci.toml & pants.toml. + # This action also creates 3 GHA caches (1 is optional). + # - `pants-setup` has the bootsrapped pants install + # - `pants-named-caches` has pip/wheel and PEX caches + # - `pants-lmdb-store` has the fine-grained process cache. + # If we ever use a remote cache, then we can drop this. + # Otherwise, we may need an additional workflow or job to delete old caches + # if they are not expiring fast enough, and we hit the GHA 10GB per repo max. + with: + base-branch: master + # To ignore a bad cache, bump the cache* integer. + gha-cache-key: ${{ inputs.gha-cache-key }} + # This hash should include all of our lockfiles so that the pip/pex caches + # get invalidated on any transitive dependency update. + named-caches-hash: ${{ hashFiles('lockfiles/*.lock') }} + # enable the optional lmdb_store cache since we're not using remote caching. + cache-lmdb-store: 'true' + # install whatever version of python we need for our in-repo pants-plugins + setup-python-for-plugins: 'true' + diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 851cb3e1c0..12564359ef 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -57,26 +57,10 @@ jobs: ./scripts/github/install-apt-packages-use-cache.sh - name: Initialize Pants and its GHA caches - uses: pantsbuild/actions/init-pants@v8 - # This action adds an env var to make pants use both pants.ci.toml & pants.toml. - # This action also creates 3 GHA caches (1 is optional). - # - `pants-setup` has the bootsrapped pants install - # - `pants-named-caches` has pip/wheel and PEX caches - # - `pants-lmdb-store` has the fine-grained process cache. - # If we ever use a remote cache, then we can drop this. - # Otherwise, we may need an additional workflow or job to delete old caches - # if they are not expiring fast enough, and we hit the GHA 10GB per repo max. + uses: ./.github/actions/init-pants.yaml with: - base-branch: master # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0 - # This hash should include all of our lockfiles so that the pip/pex caches - # get invalidated on any transitive dependency update. - named-caches-hash: ${{ hashFiles('requirements.txt') }} - # enable the optional lmdb_store cache since we're not using remote caching. - cache-lmdb-store: 'true' - # install whatever version of python we need for our in-repo pants-plugins - setup-python-for-plugins: 'true' - name: Lint run: | diff --git a/.github/workflows/pants.yaml b/.github/workflows/pants.yaml index d695aefc23..2c16ebf449 100644 --- a/.github/workflows/pants.yaml +++ b/.github/workflows/pants.yaml @@ -30,26 +30,10 @@ jobs: submodules: 'true' - name: Initialize Pants and its GHA caches - uses: pantsbuild/actions/init-pants@v8 - # This action adds an env var to make pants use both pants.ci.toml & pants.toml. - # This action also creates 3 GHA caches (1 is optional). - # - `pants-setup` has the bootsrapped pants install - # - `pants-named-caches` has pip/wheel and PEX caches - # - `pants-lmdb-store` has the fine-grained process cache. - # If we ever use a remote cache, then we can drop this. - # Otherwise, we may need an additional workflow or job to delete old caches - # if they are not expiring fast enough, and we hit the GHA 10GB per repo max. + uses: ./.github/actions/init-pants.yaml with: - base-branch: master # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0-BUILD - # This hash should include all of our lockfiles so that the pip/pex caches - # get invalidated on any transitive dependency update. - named-caches-hash: ${{ hashFiles('requirements.txt') }} - # enable the optional lmdb_store cache since we're not using remote caching. - cache-lmdb-store: 'true' - # install whatever version of python we need for our in-repo pants-plugins - setup-python-for-plugins: 'true' - name: Check BUILD files run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8d7e94a6b4..a8f25b6e6f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -102,26 +102,10 @@ jobs: ./scripts/github/install-apt-packages-use-cache.sh - name: Initialize Pants and its GHA caches - uses: pantsbuild/actions/init-pants@v8 - # This action adds an env var to make pants use both pants.ci.toml & pants.toml. - # This action also creates 3 GHA caches (1 is optional). - # - `pants-setup` has the bootsrapped pants install - # - `pants-named-caches` has pip/wheel and PEX caches - # - `pants-lmdb-store` has the fine-grained process cache. - # If we ever use a remote cache, then we can drop this. - # Otherwise, we may need an additional workflow or job to delete old caches - # if they are not expiring fast enough, and we hit the GHA 10GB per repo max. + uses: ./.github/actions/init-pants.yaml with: - base-branch: master # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0-py${{ matrix.python-version }} - # This hash should include all of our lockfiles so that the pip/pex caches - # get invalidated on any transitive dependency update. - named-caches-hash: ${{ hashFiles('requirements.txt') }} - # enable the optional lmdb_store cache since we're not using remote caching. - cache-lmdb-store: 'true' - # install whatever version of python we need for our in-repo pants-plugins - setup-python-for-plugins: 'true' - name: Test # We do not support running pytest everywhere yet. When we do it will be simply: From d8f06b989a1b3ddb7b7c40be0f7f39fb2e0a672a Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 16:36:40 -0500 Subject: [PATCH 2/6] GHA: factor out apt cache and install actions --- .github/actions/apt-packages.yaml | 26 +++++++ .github/workflows/ci.yaml | 73 ++----------------- .github/workflows/lint.yaml | 19 +---- .github/workflows/microbenchmarks.yaml | 16 +--- .../workflows/orquesta-integration-tests.yaml | 18 +---- .github/workflows/test.yaml | 19 +---- 6 files changed, 42 insertions(+), 129 deletions(-) create mode 100644 .github/actions/apt-packages.yaml diff --git a/.github/actions/apt-packages.yaml b/.github/actions/apt-packages.yaml new file mode 100644 index 0000000000..62eba6d034 --- /dev/null +++ b/.github/actions/apt-packages.yaml @@ -0,0 +1,26 @@ +--- +name: Cache and Install APT Dependencies +description: + Light wrapper around the actions/cache action and our script + to maintain the input vars in only one place for all workflows. + +runs: + using: "composite" + steps: + - name: Cache APT Dependencies + id: cache-apt-deps + uses: actions/cache@v4 + with: + path: | + ~/apt_cache + key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} + restore-keys: | + ${{ runner.os }}-v8-apt- + + - name: Install APT Depedencies + env: + CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} + run: | + # install dev dependencies for Python YAML and LDAP packages + # https://github.com/StackStorm/st2-auth-ldap + ./scripts/github/install-apt-packages-use-cache.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 160af875a8..86b8087c62 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -100,22 +100,8 @@ jobs: # don't want to retrieve previous cache #restore-keys: | # ${{ runner.os }}-v5-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -197,23 +183,8 @@ jobs: key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} restore-keys: | ${{ runner.os }}-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - cat /etc/environment - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -403,22 +374,8 @@ jobs: # don't want to retrieve previous cache #restore-keys: | # ${{ runner.os }}-v5-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -623,22 +580,8 @@ jobs: # don't want to retrieve previous cache #restore-keys: | # ${{ runner.os }}-v5-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 12564359ef..5332c77a7d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -38,23 +38,8 @@ jobs: # a test uses a submodule, and pants needs access to it to calculate deps. submodules: 'true' - #- name: Cache APT Dependencies - # id: cache-apt-deps - # uses: actions/cache@v4 - # with: - # path: | - # ~/apt_cache - # key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - # restore-keys: | - # ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: 'false' # cache doesn't work - #CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-cache.yaml - name: Initialize Pants and its GHA caches uses: ./.github/actions/init-pants.yaml diff --git a/.github/workflows/microbenchmarks.yaml b/.github/workflows/microbenchmarks.yaml index 5aa26ab4c5..87fbe89fe8 100644 --- a/.github/workflows/microbenchmarks.yaml +++ b/.github/workflows/microbenchmarks.yaml @@ -91,20 +91,8 @@ jobs: # don't want to retrieve previous cache #restore-keys: | # ${{ runner.os }}-v5-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Dependencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/orquesta-integration-tests.yaml b/.github/workflows/orquesta-integration-tests.yaml index d7f54a4715..684feed8d2 100644 --- a/.github/workflows/orquesta-integration-tests.yaml +++ b/.github/workflows/orquesta-integration-tests.yaml @@ -146,22 +146,8 @@ jobs: # don't want to retrieve previous cache #restore-keys: | # ${{ runner.os }}-v5-python-${{ matrix.python }}- - - name: Cache APT Dependencies - id: cache-apt-deps - uses: actions/cache@v4 - with: - path: | - ~/apt_cache - key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - restore-keys: | - ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-cache.yaml - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a8f25b6e6f..dc64583db3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -83,23 +83,8 @@ jobs: python-version: '${{ matrix.python-version }}' - #- name: Cache APT Dependencies - # id: cache-apt-deps - # uses: actions/cache@v4 - # with: - # path: | - # ~/apt_cache - # key: ${{ runner.os }}-v8-apt-${{ hashFiles('scripts/github/apt-packages.txt') }} - # restore-keys: | - # ${{ runner.os }}-v8-apt- - - name: Install APT Depedencies - env: - CACHE_HIT: 'false' # cache doesn't work - #CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} - run: | - # install dev dependencies for Python YAML and LDAP packages - # https://github.com/StackStorm/st2-auth-ldap - ./scripts/github/install-apt-packages-use-cache.sh + - name: Cache and Install APT Dependencies + uses: ./.github/actions/apt-cache.yaml - name: Initialize Pants and its GHA caches uses: ./.github/actions/init-pants.yaml From 003539575c4e5e7b51e2195cbbd802e83f6a1ebc Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 17:37:10 -0500 Subject: [PATCH 3/6] GHA: factor out python setup and cache actions --- .github/actions/setup-python.yaml | 34 +++++++++ .github/workflows/ci.yaml | 74 ++----------------- .github/workflows/microbenchmarks.yaml | 16 +--- .../workflows/orquesta-integration-tests.yaml | 19 +---- 4 files changed, 46 insertions(+), 97 deletions(-) create mode 100644 .github/actions/setup-python.yaml diff --git a/.github/actions/setup-python.yaml b/.github/actions/setup-python.yaml new file mode 100644 index 0000000000..1026f32927 --- /dev/null +++ b/.github/actions/setup-python.yaml @@ -0,0 +1,34 @@ +--- +name: Install Python and Cache Deps +description: + Light wrapper around the actions/setup-python and actions/cache actions + to maintain the input vars in only one place for all workflows. + +input: + python-version: + description: Which version of python to install. + required: true + +runs: + using: "composite" + steps: + - name: 'Set up Python (${{ inputs.python-version }})' + uses: actions/setup-python@v5 + with: + python-version: '${{ inputs.python-version }}' + + - name: Cache Python Dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + virtualenv + ~/virtualenv + # TODO: maybe make the virtualenv a partial cache to exclude st2*? + # !virtualenv/lib/python*/site-packages/st2* + # !virtualenv/bin/st2* + key: ${{ runner.os }}-v5-python-${{ inputs.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} + # Don't use alternative key as if requirements.txt has altered we + # don't want to retrieve previous cache + #restore-keys: | + # ${{ runner.os }}-v5-python-${{ inputs.python }}- diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86b8087c62..62d400f343 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -81,25 +81,10 @@ jobs: - name: Custom Environment Setup run: | ./scripts/github/setup-environment.sh - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - # TODO: maybe make the virtualenv a partial cache to exclude st2*? - # !virtualenv/lib/python*/site-packages/st2* - # !virtualenv/bin/st2* - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - # Don't use alternative key as if requirements.txt has altered we - # don't want to retrieve previous cache - #restore-keys: | - # ${{ runner.os }}-v5-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv @@ -166,23 +151,10 @@ jobs: - name: Custom Environment Setup run: | ./scripts/github/setup-environment.sh - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - # TODO: maybe make the virtualenv a partial cache to exclude st2*? - # !virtualenv/lib/python*/site-packages/st2* - # !virtualenv/bin/st2* - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - restore-keys: | - ${{ runner.os }}-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv @@ -355,25 +327,10 @@ jobs: - name: Custom Environment Setup run: | ./scripts/github/setup-environment.sh - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - # TODO: maybe make the virtualenv a partial cache to exclude st2*? - # !virtualenv/lib/python*/site-packages/st2* - # !virtualenv/bin/st2* - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - # Don't use alternative key as if requirements.txt has altered we - # don't want to retrieve previous cache - #restore-keys: | - # ${{ runner.os }}-v5-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv @@ -561,25 +518,10 @@ jobs: - name: Custom Environment Setup run: | ./scripts/github/setup-environment.sh - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - # TODO: maybe make the virtualenv a partial cache to exclude st2*? - # !virtualenv/lib/python*/site-packages/st2* - # !virtualenv/bin/st2* - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - # Don't use alternative key as if requirements.txt has altered we - # don't want to retrieve previous cache - #restore-keys: | - # ${{ runner.os }}-v5-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv diff --git a/.github/workflows/microbenchmarks.yaml b/.github/workflows/microbenchmarks.yaml index 87fbe89fe8..1ae59f9e19 100644 --- a/.github/workflows/microbenchmarks.yaml +++ b/.github/workflows/microbenchmarks.yaml @@ -75,22 +75,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - # Don't use alternative key as if requirements.txt has altered we - # don't want to retrieve previous cache - #restore-keys: | - # ${{ runner.os }}-v5-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-packages.yaml - name: Install virtualenv diff --git a/.github/workflows/orquesta-integration-tests.yaml b/.github/workflows/orquesta-integration-tests.yaml index 684feed8d2..c3d1d4d411 100644 --- a/.github/workflows/orquesta-integration-tests.yaml +++ b/.github/workflows/orquesta-integration-tests.yaml @@ -127,25 +127,10 @@ jobs: - name: Custom Environment Setup run: | ./scripts/github/setup-environment.sh - - name: 'Set up Python (${{ matrix.python-version }})' - uses: actions/setup-python@v5 + - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' + uses: ./.github/actions/setup-python.yaml with: python-version: '${{ matrix.python-version }}' - - name: Cache Python Dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - virtualenv - ~/virtualenv - # TODO: maybe make the virtualenv a partial cache to exclude st2*? - # !virtualenv/lib/python*/site-packages/st2* - # !virtualenv/bin/st2* - key: ${{ runner.os }}-v5-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt', 'lockfiles/*.lock') }} - # Don't use alternative key as if requirements.txt has altered we - # don't want to retrieve previous cache - #restore-keys: | - # ${{ runner.os }}-v5-python-${{ matrix.python }}- - name: Cache and Install APT Dependencies uses: ./.github/actions/apt-cache.yaml - name: Install virtualenv From 033bb85a0d5c166beb712301f9482f56b3bb26ec Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 17:58:25 -0500 Subject: [PATCH 4/6] GHA: misc cleanups missed in previuos PRs --- .github/workflows/ci.yaml | 1 + .github/workflows/microbenchmarks.yaml | 2 +- .github/workflows/orquesta-integration-tests.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 62d400f343..40dab73af1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -594,6 +594,7 @@ jobs: if: always() needs: - lint-checks + - self-check - unit-tests - integration-tests runs-on: ubuntu-20.04 diff --git a/.github/workflows/microbenchmarks.yaml b/.github/workflows/microbenchmarks.yaml index 1ae59f9e19..8116c55ab7 100644 --- a/.github/workflows/microbenchmarks.yaml +++ b/.github/workflows/microbenchmarks.yaml @@ -98,7 +98,7 @@ jobs: - name: Upload Histograms uses: actions/upload-artifact@v4 with: - name: benchmark_histograms + name: benchmark_histograms-py${{ matrix.python-version }} path: benchmark_histograms/ retention-days: 30 diff --git a/.github/workflows/orquesta-integration-tests.yaml b/.github/workflows/orquesta-integration-tests.yaml index c3d1d4d411..8b372ab918 100644 --- a/.github/workflows/orquesta-integration-tests.yaml +++ b/.github/workflows/orquesta-integration-tests.yaml @@ -185,6 +185,7 @@ jobs: - name: Compress Service Logs Before upload if: ${{ failure() }} run: | + ./tools/launchdev.sh stop # stop st2 before collecting logs tar cvzpf logs.tar.gz logs/* - name: Upload StackStorm services Logs if: ${{ failure() }} From 8eef35808d507f9e114c93cb2dc222e1b07cc95f Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 18:14:24 -0500 Subject: [PATCH 5/6] GHA: correct composite action reference Apparently each action must be in its own folder. --- .../action.yaml} | 0 .../{init-pants.yaml => init-pants/action.yaml} | 0 .../action.yaml} | 0 .github/workflows/ci.yaml | 16 ++++++++-------- .github/workflows/lint.yaml | 4 ++-- .github/workflows/microbenchmarks.yaml | 4 ++-- .../workflows/orquesta-integration-tests.yaml | 4 ++-- .github/workflows/pants.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) rename .github/actions/{apt-packages.yaml => apt-packages/action.yaml} (100%) rename .github/actions/{init-pants.yaml => init-pants/action.yaml} (100%) rename .github/actions/{setup-python.yaml => setup-python/action.yaml} (100%) diff --git a/.github/actions/apt-packages.yaml b/.github/actions/apt-packages/action.yaml similarity index 100% rename from .github/actions/apt-packages.yaml rename to .github/actions/apt-packages/action.yaml diff --git a/.github/actions/init-pants.yaml b/.github/actions/init-pants/action.yaml similarity index 100% rename from .github/actions/init-pants.yaml rename to .github/actions/init-pants/action.yaml diff --git a/.github/actions/setup-python.yaml b/.github/actions/setup-python/action.yaml similarity index 100% rename from .github/actions/setup-python.yaml rename to .github/actions/setup-python/action.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40dab73af1..12e0b61ff2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -82,11 +82,11 @@ jobs: run: | ./scripts/github/setup-environment.sh - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-packages.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -152,11 +152,11 @@ jobs: run: | ./scripts/github/setup-environment.sh - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-packages.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -328,11 +328,11 @@ jobs: run: | ./scripts/github/setup-environment.sh - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-packages.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh @@ -519,11 +519,11 @@ jobs: run: | ./scripts/github/setup-environment.sh - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-packages.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5332c77a7d..8d0eff683a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -39,10 +39,10 @@ jobs: submodules: 'true' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-cache.yaml + uses: ./.github/actions/apt-packages - name: Initialize Pants and its GHA caches - uses: ./.github/actions/init-pants.yaml + uses: ./.github/actions/init-pants with: # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0 diff --git a/.github/workflows/microbenchmarks.yaml b/.github/workflows/microbenchmarks.yaml index 8116c55ab7..667a252a94 100644 --- a/.github/workflows/microbenchmarks.yaml +++ b/.github/workflows/microbenchmarks.yaml @@ -76,11 +76,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-packages.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/orquesta-integration-tests.yaml b/.github/workflows/orquesta-integration-tests.yaml index 8b372ab918..fe3e855fc3 100644 --- a/.github/workflows/orquesta-integration-tests.yaml +++ b/.github/workflows/orquesta-integration-tests.yaml @@ -128,11 +128,11 @@ jobs: run: | ./scripts/github/setup-environment.sh - name: 'Set up Python (${{ matrix.python-version }}) and Cache Deps' - uses: ./.github/actions/setup-python.yaml + uses: ./.github/actions/setup-python with: python-version: '${{ matrix.python-version }}' - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-cache.yaml + uses: ./.github/actions/apt-packages - name: Install virtualenv run: | ./scripts/github/install-virtualenv.sh diff --git a/.github/workflows/pants.yaml b/.github/workflows/pants.yaml index 2c16ebf449..0d3e85be81 100644 --- a/.github/workflows/pants.yaml +++ b/.github/workflows/pants.yaml @@ -30,7 +30,7 @@ jobs: submodules: 'true' - name: Initialize Pants and its GHA caches - uses: ./.github/actions/init-pants.yaml + uses: ./.github/actions/init-pants with: # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0-BUILD diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dc64583db3..3f2145828c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -84,10 +84,10 @@ jobs: - name: Cache and Install APT Dependencies - uses: ./.github/actions/apt-cache.yaml + uses: ./.github/actions/apt-packages - name: Initialize Pants and its GHA caches - uses: ./.github/actions/init-pants.yaml + uses: ./.github/actions/init-pants with: # To ignore a bad cache, bump the cache* integer. gha-cache-key: cache0-py${{ matrix.python-version }} From 735e9260eff55542c8219002570d0b0909af0a51 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 17 May 2024 18:23:00 -0500 Subject: [PATCH 6/6] GHA: composite actions require explicitly setting shell --- .github/actions/apt-packages/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/apt-packages/action.yaml b/.github/actions/apt-packages/action.yaml index 62eba6d034..616f17fea3 100644 --- a/.github/actions/apt-packages/action.yaml +++ b/.github/actions/apt-packages/action.yaml @@ -18,6 +18,7 @@ runs: ${{ runner.os }}-v8-apt- - name: Install APT Depedencies + shell: bash env: CACHE_HIT: ${{steps.cache-apt-deps.outputs.cache-hit}} run: |