Skip to content

Merge pull request #577 from Backblaze/blind_fix_rtd #1250

Merge pull request #577 from Backblaze/blind_fix_rtd

Merge pull request #577 from Backblaze/blind_fix_rtd #1250

Workflow file for this run

name: Continuous Integration
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
PYTHON_DEFAULT_VERSION: "3.14"
UV_VERSION: "0.8.24"
jobs:
lint:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: codespell-project/actions-codespell@2391250ab05295bddd51e36a8c6295edb6343b0e
with:
ignore_words_list: datas re-use
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
run: uv sync --only-group nox --locked
- name: Run linters
run: uv run nox -vs lint
- name: Validate new changelog entries
if: (contains(github.event.pull_request.labels.*.name, '-changelog') == false) && (github.event.pull_request.base.ref != '')
run: |
mapfile -t changed_files < <(git diff --diff-filter=ACMR --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD)
if [ "${#changed_files[@]}" -eq 1 ] && [ "${changed_files[0]}" = "uv.lock" ]; then
echo "Skipping changelog validation for lockfile-only change."
exit 0
fi
if [ -z "$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD -- changelog.d)" ]; then
echo "No changelog item added."
exit 1
fi
- name: Changelog validation
run: uv run nox -vs towncrier_check
build:
timeout-minutes: 30
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
run: uv sync --only-group nox --locked
- name: Build the distribution
run: uv run nox -vs build
cleanup_buckets:
timeout-minutes: 30
needs: lint
env:
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- uses: astral-sh/setup-uv@v7
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
run: uv sync --only-group nox --locked
- name: Find and remove old buckets
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
run: uv run nox -vs cleanup_old_buckets
test:
timeout-minutes: 90
needs: cleanup_buckets
env:
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
NOX_EXTRAS: ${{ matrix.extras }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.10"]
extras: [ "" ]
exclude:
- os: "macos-latest"
python-version: "pypy3.10"
- os: "windows-latest"
python-version: "pypy3.10"
include:
- python-version: "3.12"
extras: "full"
os: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
run: uv sync --only-group nox --locked
- name: Run unit tests
run: uv run nox -vs unit -- -v
- name: Run integration tests
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
run: uv run nox -vs integration -- --dont-cleanup-old-buckets -v
cli-compat:
timeout-minutes: 90
needs: cleanup_buckets
env:
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
INSTALL_SDK_FROM: ../b2-sdk-python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.14"
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: b2-sdk-python
- uses: actions/checkout@v4
with:
repository: Backblaze/B2_Command_Line_Tool
path: B2_Command_Line_Tool
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install test binary dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get -y update
sudo apt-get -y install zsh fish
sudo chmod -R 755 /usr/share/zsh/vendor-completions /usr/share/zsh
- name: Install test binary dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install fish
- name: Install dependencies
run: uv sync --directory ./B2_Command_Line_Tool --locked --group nox
- name: Run CLI unit tests
run: uv run --directory ./B2_Command_Line_Tool nox -vs unit -p ${{ matrix.python-version }}
- name: Run CLI integration tests (without secrets)
run: uv run --directory ./B2_Command_Line_Tool nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets"
- name: Run CLI integration tests (with secrets)
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14' }}
working-directory: B2_Command_Line_Tool
run: |
export VIRTUAL_ENV="$PWD/.nox/integration-3-14"
export PATH="$VIRTUAL_ENV/bin:$PATH"
python -m pytest \
test/integration \
-n 1 \
--log-level INFO \
-W ignore::DeprecationWarning:rst2ansi.visitor: \
-m "require_secrets" \
--cleanup \
--sut "$VIRTUAL_ENV/bin/b2v4"
doc:
timeout-minutes: 30
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install system dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt-get install -y graphviz plantuml
- name: Install dependencies
run: uv sync --only-group nox --locked
- name: Build the docs
run: uv run nox --non-interactive -vs doc