diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2787d22..3b785aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: - name: Install Linux packages run: | sudo apt-get update - sudo apt-get install -y rclone openssh-server + sudo apt-get install -y rclone openssh-server curl - name: Configure OpenSSH SFTP server (test only) run: | sudo mkdir -p /run/sshd @@ -95,6 +95,31 @@ jobs: ssh-add ~/.ssh/id_ed25519 # Export SFTP test URL for tox via GITHUB_ENV echo "BORGSTORE_TEST_SFTP_URL=sftp://sftpuser@localhost:22/borgstore/temp-store" >> $GITHUB_ENV + - name: Install and configure MinIO S3 server (test only) + run: | + set -e + arch=$(uname -m) + case "$arch" in + x86_64|amd64) srv_url=https://dl.min.io/server/minio/release/linux-amd64/minio; cli_url=https://dl.min.io/client/mc/release/linux-amd64/mc ;; + aarch64|arm64) srv_url=https://dl.min.io/server/minio/release/linux-arm64/minio; cli_url=https://dl.min.io/client/mc/release/linux-arm64/mc ;; + *) echo "Unsupported arch: $arch"; exit 1 ;; + esac + curl -fsSL -o /usr/local/bin/minio "$srv_url" + curl -fsSL -o /usr/local/bin/mc "$cli_url" + sudo chmod +x /usr/local/bin/minio /usr/local/bin/mc + export PATH=/usr/local/bin:$PATH + # Start MinIO on :9000 with default credentials (minioadmin/minioadmin) + MINIO_DIR="$GITHUB_WORKSPACE/.minio-data" + MINIO_LOG="$GITHUB_WORKSPACE/.minio.log" + mkdir -p "$MINIO_DIR" + nohup minio server "$MINIO_DIR" --address ":9000" >"$MINIO_LOG" 2>&1 & + # Wait for MinIO port to be ready + for i in $(seq 1 60); do (echo > /dev/tcp/127.0.0.1/9000) >/dev/null 2>&1 && break; sleep 1; done + # Configure client and create bucket + mc alias set local http://127.0.0.1:9000 minioadmin minioadmin + mc mb --ignore-existing local/test + # Export S3 test URL for tox via GITHUB_ENV + echo "BORGSTORE_TEST_S3_URL=s3:minioadmin:minioadmin@http://127.0.0.1:9000/test/path" >> $GITHUB_ENV - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -103,7 +128,8 @@ jobs: run: | python -m pip install --upgrade pip setuptools pip install -r requirements.d/dev.txt - - name: Install borgstore (with sftp extra) - run: pip install -ve ".[sftp]" - - name: run tox env - run: tox -e sftp + - name: Install borgstore (with all extras) + run: pip install -ve ".[s3,sftp]" + - name: run tox envs + run: | + tox -e all_extras diff --git a/tox.ini b/tox.ini index 4992f90..c25dded 100644 --- a/tox.ini +++ b/tox.ini @@ -40,3 +40,12 @@ deps = commands = pytest -v -rs tests pass_env = BORGSTORE_TEST_SFTP_URL + +[testenv:all_extras] +deps = + pytest + boto3 + paramiko +commands = pytest -v -rs tests +pass_env = + BORGSTORE_TEST_*_URL