Skip to content

Live tests: use variable for client schemes, allowing override (#467) #1096

Live tests: use variable for client schemes, allowing override (#467)

Live tests: use variable for client schemes, allowing override (#467) #1096

Workflow file for this run

name: tests
on:
push:
branches: [master]
pull_request:
schedule:
# Run every Sunday
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Lint package
run: |
make lint
tests:
name: Mocked Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: code-quality
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Run mocked tests
run: |
make test
- name: Build distribution and test installation
shell: bash
run: |
make dist
uv pip install cloudpathlib@$(find dist -name 'cloudpathlib*.whl') --no-deps --force-reinstall
python -c "import cloudpathlib"
uv pip install cloudpathlib@$(find dist -name 'cloudpathlib*.tar.gz') --no-deps --force-reinstall
python -c "import cloudpathlib"
- name: Upload coverage to codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
live-tests:
name: Live Tests
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Run live tests
run: |
make test-live-cloud
env:
LIVE_AZURE_CONTAINER: ${{ secrets.LIVE_AZURE_CONTAINER }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
AZURE_STORAGE_GEN2_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_GEN2_CONNECTION_STRING }}
LIVE_GS_BUCKET: ${{ secrets.LIVE_GS_BUCKET }}
LIVE_S3_BUCKET: ${{ secrets.LIVE_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CUSTOM_S3_BUCKET: ${{secrets.CUSTOM_S3_BUCKET}}
CUSTOM_S3_KEY_ID: ${{secrets.CUSTOM_S3_KEY_ID}}
CUSTOM_S3_SECRET_KEY: ${{secrets.CUSTOM_S3_SECRET_KEY}}
CUSTOM_S3_ENDPOINT: ${{secrets.CUSTOM_S3_ENDPOINT}}
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
extras-test:
name: Test independent installs of clients
needs: tests
runs-on: ubuntu-latest
strategy:
matrix:
extra: ["s3", "azure", "gs"]
include:
- prefix: "s3"
extra: "s3"
- prefix: "az"
extra: "azure"
- prefix: "gs"
extra: "gs"
steps:
- uses: actions/checkout@v4
- name: Set up Python and uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: "3.11"
- name: Build cloudpathlib
run: |
uv pip install build
make dist # build cloudpathlib wheel
- name: Create empty venv
run: |
uv venv ${{ matrix.extra }}-env
- name: Install cloudpathlib[${{ matrix.extra }}]
run: |
source ${{ matrix.extra }}-env/bin/activate
uv pip install "cloudpathlib[${{ matrix.extra }}]@$(find dist -name 'cloudpathlib*.whl')"
- name: Test ${{ matrix.extra }} usage
run: |
source ${{ matrix.extra }}-env/bin/activate
python -c 'from cloudpathlib import CloudPath; CloudPath("${{ matrix.prefix }}://bucket/test")'
env:
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
notify:
name: Notify failed build
needs: [code-quality, tests, live-tests, extras-test]
if: failure() && github.event.pull_request == null
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}