diff --git a/.github/workflows/conda-cpp-build.yaml b/.github/workflows/conda-cpp-build.yaml index 19ae9e2b..98c353bb 100644 --- a/.github/workflows/conda-cpp-build.yaml +++ b/.github/workflows/conda-cpp-build.yaml @@ -68,6 +68,35 @@ on: When this is non-empty, that secret's value is used in place of the default repo-level token anywhere that environment variable GH_TOKEN is set. This is especially useful for downloading artifacts from other private repos, which repo tokens do not have access to. + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix identity + so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. + Use workspace-relative paths for directories managed by cache-paths. defaults: run: @@ -122,6 +151,28 @@ jobs: ref: ${{ inputs.sha }} fetch-depth: 0 persist-credentials: true + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} - name: Standardize repository information env: RAPIDS_REPOSITORY: ${{ inputs.repo || github.repository }} diff --git a/.github/workflows/conda-cpp-tests.yaml b/.github/workflows/conda-cpp-tests.yaml index 7af9426b..8ec8e2d5 100644 --- a/.github/workflows/conda-cpp-tests.yaml +++ b/.github/workflows/conda-cpp-tests.yaml @@ -74,6 +74,35 @@ on: When this is non-empty, that secret's value is used in place of the default repo-level token anywhere that environment variable GH_TOKEN is set. This is especially useful for downloading artifacts from other private repos, which repo tokens do not have access to. + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix + identity so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. + Use workspace-relative paths for directories managed by cache-paths. secrets: script-env-secret-1-key: description: | @@ -164,6 +193,29 @@ jobs: ref: ${{ inputs.sha }} fetch-depth: 0 persist-credentials: true + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: | + ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} # This has to be AFTER the checkout step. It creates a telemetry-artifacts directory, # and the checkout step would destroy it. - name: Telemetry setup diff --git a/.github/workflows/conda-python-build.yaml b/.github/workflows/conda-python-build.yaml index 69a2535b..33c239b9 100644 --- a/.github/workflows/conda-python-build.yaml +++ b/.github/workflows/conda-python-build.yaml @@ -78,6 +78,35 @@ on: or CUDA version. 'cuda_major' if the package is not dependent on operating system, Python minor version, or CPU architecture, but is dependent on CUDA major version." + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix identity + so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. + Use workspace-relative paths for directories managed by cache-paths. defaults: run: @@ -132,6 +161,28 @@ jobs: ref: ${{ inputs.sha }} fetch-depth: 0 persist-credentials: true + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} - name: Standardize repository information env: RAPIDS_REPOSITORY: ${{ inputs.repo || github.repository }} diff --git a/.github/workflows/conda-python-tests.yaml b/.github/workflows/conda-python-tests.yaml index 8984aa27..f31d8c2a 100644 --- a/.github/workflows/conda-python-tests.yaml +++ b/.github/workflows/conda-python-tests.yaml @@ -77,6 +77,35 @@ on: When this is non-empty, that secret's value is used in place of the default repo-level token anywhere that environment variable GH_TOKEN is set. This is especially useful for downloading artifacts from other private repos, which repo tokens do not have access to. + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix identity + so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. Use + workspace-relative paths for directories managed by cache-paths. secrets: script-env-secret-1-key: description: | @@ -179,6 +208,30 @@ jobs: fetch-depth: 0 persist-credentials: true + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: | + ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} + - name: Standardize repository information uses: rapidsai/shared-actions/rapids-github-info@main with: diff --git a/.github/workflows/wheels-build.yaml b/.github/workflows/wheels-build.yaml index 4cb7a286..f8705584 100644 --- a/.github/workflows/wheels-build.yaml +++ b/.github/workflows/wheels-build.yaml @@ -108,6 +108,35 @@ on: When this is non-empty, that secret's value is used in place of the default repo-level token anywhere that environment variable GH_TOKEN is set. This is especially useful for downloading artifacts from other private repos, which repo tokens do not have access to. + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix identity + so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. + Use workspace-relative paths for directories managed by cache-paths. defaults: run: @@ -165,6 +194,29 @@ jobs: fetch-depth: 0 persist-credentials: false + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} + - name: Standardize repository information uses: rapidsai/shared-actions/rapids-github-info@main with: diff --git a/.github/workflows/wheels-test.yaml b/.github/workflows/wheels-test.yaml index b3c66b2a..031d90ed 100644 --- a/.github/workflows/wheels-test.yaml +++ b/.github/workflows/wheels-test.yaml @@ -93,6 +93,35 @@ on: type: boolean required: false default: false + cache-paths: + type: string + required: false + default: "" + description: | + Newline-separated workspace-relative files or directories to persist with actions/cache. + Workspace-relative paths are required for cache saves from job containers. Must be provided + together with cache-key-prefix. + cache-key-prefix: + type: string + required: false + default: "" + description: | + Prefix for the actions/cache key for cache-paths. The workflow appends its matrix identity + so caches are not shared across incompatible runners or environments. + cache-key-files: + type: string + required: false + default: "" + description: | + Newline-separated files or glob patterns to hash into the cache key. Use this for caches + that must be saved again when relevant source or dependency files change. + cache-environment: + type: string + required: false + default: "" + description: | + Newline-separated literal NAME=VALUE pairs exported before the caller script runs. Use + workspace-relative paths for directories managed by cache-paths. secrets: script-env-secret-1-key: description: | @@ -187,6 +216,30 @@ jobs: fetch-depth: 0 persist-credentials: false + - name: Validate caller cache configuration + if: inputs.cache-paths != '' || inputs.cache-key-prefix != '' || inputs.cache-key-files != '' || inputs.cache-environment != '' + run: | + if test -z "${INPUTS_CACHE_PATHS}" || test -z "${INPUTS_CACHE_KEY_PREFIX}"; then + echo "ERROR: cache-paths and cache-key-prefix must be provided together." + exit 1 + fi + env: + INPUTS_CACHE_PATHS: ${{ inputs.cache-paths }} + INPUTS_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }} + - name: Cache caller paths + if: inputs.cache-paths != '' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}-${{ hashFiles(inputs.cache-key-files) }} + restore-keys: | + ${{ inputs.cache-key-prefix }}-${{ matrix.CUDA_VER }}-${{ matrix.PY_VER }}-${{ matrix.ARCH }}-${{ matrix.LINUX_VER }}-${{ matrix.GPU }}-${{ matrix.DRIVER }}-${{ matrix.DEPENDENCIES }}- + - name: Configure caller cache environment + if: inputs.cache-environment != '' + run: printf '%s\n' "$INPUTS_CACHE_ENVIRONMENT" >> "$GITHUB_ENV" + env: + INPUTS_CACHE_ENVIRONMENT: ${{ inputs.cache-environment }} + - name: Telemetry setup uses: rapidsai/shared-actions/telemetry-dispatch-setup@main continue-on-error: true