Merge pull request #912 from Backblaze/s3endpoint #719
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: Continuous Integration | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
PYTHON_DEFAULT_VERSION: "3.11" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: codespell-project/actions-codespell@2391250ab05295bddd51e36a8c6295edb6343b0e | |
with: | |
ignore_words_list: datas | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: python -m pip install --upgrade nox pip setuptools | |
- name: Run linters | |
run: nox -vs lint | |
- name: Validate changelog | |
# Library was designed to be used with pull requests only. | |
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} | |
uses: zattoo/changelog@v1 | |
with: | |
token: ${{ github.token }} | |
build: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: python -m pip install --upgrade nox pip setuptools | |
- name: Build the distribution | |
run: nox -vs build >> $GITHUB_OUTPUT | |
cleanup_buckets: | |
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@v3 | |
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@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
cache: "pip" | |
- name: Install dependencies | |
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
run: python -m pip install --upgrade nox pip setuptools | |
- 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: nox -vs cleanup_buckets | |
test: | |
needs: cleanup_buckets | |
env: | |
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy-3.10"] | |
exclude: | |
- os: "macos-latest" | |
python-version: "pypy-3.10" | |
- os: "windows-latest" | |
python-version: "pypy-3.10" | |
# FIXME remove these exclusions after 3.12 release; 3.12-dev setlocale(...) is broken on Windows & Mac | |
- os: "macos-latest" | |
python-version: "3.12-dev" | |
- os: "windows-latest" | |
python-version: "3.12-dev" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: python -m pip install --upgrade nox pip setuptools | |
- name: Run unit tests | |
run: nox -vs unit | |
- name: Run integration tests (without secrets) | |
run: nox -vs integration -- -m "not require_secrets" | |
- name: Run integration tests (with secrets) | |
# Limit CI workload by running integration tests with secrets only on edge Python versions. | |
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.7", "pypy-3.10", "3.11"]'), matrix.python-version) }} | |
run: nox -vs integration -- -m "require_secrets" --cleanup | |
test-docker: | |
needs: cleanup_buckets | |
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 | |
# Running on raw machine. | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: python -m pip install --upgrade nox pip setuptools | |
- name: Run dockerized tests | |
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
run: nox -vs docker_test | |
test-linux-bundle: | |
needs: cleanup_buckets | |
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 | |
container: | |
image: "python:3.11" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
apt-get -y update | |
apt-get -y install patchelf | |
python -m pip install --upgrade nox pip setuptools | |
git config --global --add safe.directory '*' | |
- name: Bundle the distribution | |
id: bundle | |
run: nox -vs bundle >> $GITHUB_OUTPUT | |
- name: Generate hashes | |
id: hashes | |
run: nox -vs make_dist_digest | |
- name: Run integration tests (without secrets) | |
run: nox -vs integration -- -m "not require_secrets" | |
- name: Run integration tests (with secrets) | |
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
run: nox -vs integration -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup | |
- name: Upload assets | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
path: ${{ steps.bundle.outputs.asset_path }} | |
if-no-files-found: warn | |
retention-days: 7 | |
test-windows-bundle: | |
needs: cleanup_buckets | |
env: | |
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: python -m pip install --upgrade nox pip setuptools | |
- name: Bundle the distribution | |
id: bundle | |
shell: bash | |
run: nox -vs bundle >> $GITHUB_OUTPUT | |
- name: Generate hashes | |
id: hashes | |
run: nox -vs make_dist_digest | |
- name: Run integration tests (without secrets) | |
run: nox -vs integration -- -m "not require_secrets" | |
- name: Run integration tests (with secrets) | |
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
run: nox -vs integration -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup | |
- name: Upload assets | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
path: ${{ steps.bundle.outputs.asset_path }} | |
if-no-files-found: warn | |
retention-days: 7 | |
doc: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y graphviz plantuml | |
python -m pip install --upgrade nox pip setuptools | |
- name: Build the docs | |
run: nox --non-interactive -vs doc |