Skip to content

Commit

Permalink
initial commit of s3 caching
Browse files Browse the repository at this point in the history
  • Loading branch information
felippeb committed Mar 15, 2024
1 parent 29a2fdb commit 9c63377
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/actions/build-onedir-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ inputs:
required: true
type: string
description: Seed used to invalidate caches

use-s3-cache:
required: true
decription: Use our own local s3 cache or use github's cache

env:
COLUMNS: 190
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
RELENV_BUILDENV: 1


runs:
using: composite

steps:

- name: Cache Deps Onedir Package Directory
id: onedir-pkg-cache
uses: actions/cache@v3.3.1
uses: ./.github/actions/cache
with:
path: artifacts/${{ inputs.package-name }}
key: >
Expand Down
48 changes: 48 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: cache-decider
description: Decide which cache to use
inputs:
key:
required: false
type: string
description: The onedir package name to create
default: salt
path:
required: true
type: string
description: path to contents to cache
use-s3-cache:
required: true
decription: Use our own local s3 cache or use github's cache

outputs:
cache-hit:
value: ${{ steps.s3-cache.outputs.cache-hit || steps.github-cache.outputs.cache-hit }}

runs:
using: composite

steps:
- name: Configure AWS Credentials to access cache bucket
if: ${{ inputs.use-s3-cache == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2

- name: Cache Deps Onedir Package Directory
if: ${{ inputs.use-s3-cache == 'true' }}
id: s3-cache
env:
RUNS_ON_S3_BUCKET_CACHE: "salt-project-test-salt-github-actions-s3-cache"
uses: runs-on/cache@v4
with:
path: ${{ inputs.path }}
key: ${{ inputs.key }}

- name: Cache Deps Onedir Package Directory
if: ${{ inputs.use-s3-cache == 'false' }}
id: github-cache
uses: actions/[email protected]
with:
path: ${{ inputs.path }}
key: ${{ inputs.key }}
3 changes: 3 additions & 0 deletions .github/workflows/build-deps-onedir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
arch: ${{ matrix.arch }}
python-version: "${{ inputs.python-version }}"
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}
use-s3-cache: 'true'

build-deps-macos:
name: macOS
Expand Down Expand Up @@ -133,6 +134,7 @@ jobs:
arch: ${{ matrix.arch }}
python-version: "${{ inputs.python-version }}"
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}
use-s3-cache: 'false'

build-deps-windows:
name: Windows
Expand Down Expand Up @@ -181,3 +183,4 @@ jobs:
arch: ${{ matrix.arch }}
python-version: "${{ inputs.python-version }}"
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}
use-s3-cache: 'false'

0 comments on commit 9c63377

Please sign in to comment.