Run all tests against S3 and S3 Express #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Integration Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
ref: | ||
required: true | ||
type: string | ||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "-Dwarnings" | ||
CI_PREFIX: ${{ vars.S3_PREFIX }} | ||
jobs: | ||
integration-test: | ||
name: Integration tests | ||
runs-on: ubuntu-22.04 | ||
environment: ${{ inputs.environment }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
test-run: | ||
- name: "S3", | ||
bucket: ${{ vars.S3_BUCKET }}, | ||
region: ${{ vars.S3_REGION }}, | ||
storage-class: "" | ||
- name: "S3 Express", | ||
bucket: ${{ vars.S3_EXPRESS_BUCKET }}, | ||
region: ${{ vars.S3_EXPRESS_REGION }}, | ||
storage-class: "EXPRESS_ONEZONE" | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
submodules: true | ||
persist-credentials: false | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ vars.ACTIONS_IAM_ROLE }} | ||
aws-region: ${{ vars.S3_REGION }} | ||
- name: Set up stable Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Restore Cargo cache | ||
id: restore-cargo-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
# Manually install CPU-only version of torch so we're not carrying around giant GPU drivers/kernels | ||
python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu | ||
python -m pip install -e "s3torchconnectorclient[test,e2e]" | ||
python -m pip install -e "s3torchconnector[test,e2e]" | ||
- name: s3torchconnector ${{ matrix.test-run.name }} integration tests | ||
run: | | ||
CI_REGION=${{ matrix.test-run.region }} \ | ||
CI_BUCKET=${{ matrix.test-run.bucket }} \ | ||
CI_STORAGE_CLASS=${{ matrix.test-run.storage-class }} \ | ||
pytest s3torchconnector/tst/e2e -n auto | ||
- name: s3torchconnectorclient ${{ matrix.test-run.name }} integration tests | ||
run: | | ||
CI_REGION=${{ matrix.test-run.region }} \ | ||
CI_BUCKET=${{ matrix.test-run.bucket }} \ | ||
CI_STORAGE_CLASS=${{ matrix.test-run.storage-class }} \ | ||
pytest s3torchconnectorclient/python/tst/integration -n auto | ||
- name: Save Cargo cache | ||
uses: actions/cache/save@v3 | ||
if: inputs.environment != 'integration-tests' | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }} |