This is a fork of action-s3-cache.
The changes includes:
- Adding ability to provide aws-session-token for assuming AWS IAM roles.
- Fixing upload/download bugs (especially with larger files) and optimizing for concurrency.
- Moving to zstd rather than pgzip.
- name: Save cache
uses: try-keep/action-s3-cache@v1
with:
action: put
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1 # Or whatever region your bucket was created
bucket: your-bucket
s3-class: ONEZONE_IA # It's STANDARD by default. It can be either STANDARD,
# REDUCED_REDUDANCY, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE or STANDARD_IA.
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
default-key: ${{ runner.os }}-yarn
artifacts: |
node_modules/*- name: Retrieve cache
uses: try-keep/action-s3-cache@v1
with:
action: get
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
bucket: your-bucket
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
default-key: ${{ runner.os }}-yarn- name: Clear cache
uses: try-keep/action-s3-cache@v1
with:
action: delete
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
bucket: your-bucket
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
default-key: ${{ runner.os }}-yarnThe following example shows a simple pipeline using S3 Cache GitHub Action:
- name: Checkout
uses: actions/checkout@v2
- name: Retrieve cache
uses: try-keep/action-s3-cache@v1
with:
action: get
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
bucket: your-bucket
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
default-key: ${{ runner.os }}-yarn
- name: Install dependencies
run: yarn
- name: Save cache
uses: try-keep/action-s3-cache@v1
with:
action: put
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
bucket: your-bucket
s3-class: STANDARD_IA
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
default-key: ${{ runner.os }}-yarn
artifacts: |
node_modules/*This project includes comprehensive unit and integration tests for all S3 operations including upload, download, and delete functionality.
Run tests that don't require S3 connectivity:
make test-unitThis runs tests for:
- Archive compression/decompression
- Byte formatting utilities
- Part size optimization
Run all tests including S3 integration tests:
make testThis will:
- Automatically start MinIO (S3-compatible storage) in Docker
- Run all unit tests
- Run S3 integration tests including:
TestPutAndGetObject- Upload and download operationsTestStreamUpload- Streaming upload functionalityTestDeleteObject- Delete existing objectsTestDeleteNonExistentObject- Handle deletion of non-existent objectsTestDeleteObjectProperties- Verify object properties after deletion
- Clean up MinIO container
Start MinIO for manual testing:
make test-minio-upMinIO console will be available at http://localhost:9001 (credentials: minioadmin/minioadmin)
Stop MinIO:
make test-minio-downBuild binaries for all platforms:
make build-distThis creates binaries in the dist/ directory for Linux, macOS, and Windows.