Skip to content

Fix setuptools deprecation warning #325

Fix setuptools deprecation warning

Fix setuptools deprecation warning #325

Workflow file for this run

name: All-in-One
on:
push:
branches:
- '**'
tags-ignore:
- '**'
env:
PYTHONUNBUFFERED: "1"
UNITTEST_QUIET: "1"
# UNITTEST_SKIP_POSTGESQL: "1"
# UNITTEST_SKIP_S3: "1"
UNITTEST_SKIP_B2: "1"
UNITTEST_SKIP_NBD: "1"
jobs:
#
# Job: cancel
#
cancel:
name: "Cancel previous workflow runs"
runs-on: ubuntu-20.04
timeout-minutes: 3
steps:
- uses: styfle/cancel-workflow-action@0.11.0
with:
workflow_id: all-in-one.yaml
access_token: ${{ github.token }}
#
# Job: gather_info
#
gather_info:
name: "Gather information about the build"
needs:
- cancel
runs-on: ubuntu-20.04
outputs:
branch: ${{ steps.gather_info.outputs.branch }}
version: ${{ steps.gather_info.outputs.version }}
public_version: ${{ steps.gather_info.outputs.public_version }}
release: ${{ steps.gather_info.outputs.release }}
vcs_ref: ${{ steps.gather_info.outputs.vcs_ref }}
build_date: ${{ steps.gather_info.outputs.build_date }}
steps:
- name: Checkout repository files
uses: actions/checkout@v3
with:
# This is needed so we can determine the version properly from git history.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Determine build information
id: gather_info
shell: bash
run: |
set -ueo pipefail
branch="${GITHUB_REF#refs/heads/}"
echo "::debug::Setting branch to ${branch}"
echo "::set-output name=branch::${branch}"
version="$(./maint-scripts/get-version-miniver)"
echo "::debug::Setting version to $version"
echo "::set-output name=version::${version}"
# Remove labels for public version
public_version=${version%+*}
echo "::debug::Setting public_version to $public_version"
echo "::set-output name=public_version::${public_version}"
if [[ $version =~ ^[0-9]+\.[0-9]+.[0-9]+$ ]]; then
echo '::set-output name=release::true'
else
echo '::set-output name=release::false'
fi
echo "::set-output name=vcs_ref::$(git rev-parse --short HEAD)"
echo "::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
#
# Job: tests
#
tests:
name: "Run tests"
needs:
- gather_info
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- name: Checkout repository files
uses: actions/checkout@v3
with:
# This is needed so we can determine the version properly from git history.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Benji and its dependencies into the virtual environment
shell: bash
run: |
pip install --upgrade setuptools pip
pip install --upgrade '.[s3,b2,compression,dev,doc]'
pip freeze
- name: Set up tests
shell: bash
run: |
make -C tests/minio-setup up
make -C tests/postgresql-setup up
- name: Run tests
shell: bash
run: |
pytest src/benji/tests/
- name: Run packaging test
shell: bash
run: |
python -m build --sdist --wheel --outdir dist/ .
ls -al dist/
env:
BENJI_VERSION_OVERRIDE: "${{ needs.gather_info.outputs.public_version }}"
- name: Tear down tests
shell: bash
run: |
make -C tests/minio-setup down
make -C tests/postgresql-setup down
#
# Job: lint_chart
#
lint_chart:
needs:
- gather_info
name: "Lint the Helm chart"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository files
uses: actions/checkout@v3
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.5.2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
- name: Run chart-testing (lint)
run: ct lint --all
# install-chart:
# runs-on: ubuntu-20.04
# needs: lint-chart
# strategy:
# matrix:
# k8s:
# - v1.17.5
# - v1.18.4
# - v1.20.2
# steps:
# - name: Checkout repository files
# uses: actions/checkout@v3
#
# - name: Set up Helm
# uses: azure/setup-helm@v3
# with:
# version: v3.5.2
#
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.9
#
# - name: Set up chart-testing
# uses: helm/chart-testing-action@v2.0.1
#
# - name: Create a kind cluster
# uses: helm/kind-action@v1.1.0
# with:
# version: v0.10.0
# node_image: kindest/node:${{ matrix.k8s }}
#
# - name: Run chart-testing (install)
# run: ct install --all --debug
#
# Job: build_container_images_release
#
build_container_images_release:
needs:
- gather_info
- tests
- lint_chart
if: "needs.gather_info.outputs.release == 'true'"
name: "Build and publish container images for release"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository files
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_REGISTRY_PAT }}
- name: Build and push benji container image
uses: docker/build-push-action@v3
with:
context: .
file: ./images/benji/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/benji:latest
ghcr.io/${{ github.repository_owner }}/benji:${{ needs.gather_info.outputs.version }}
ghcr.io/${{ github.repository_owner }}/benji:${{ needs.gather_info.outputs.branch }}
build-args: |
VCS_REF=${{ needs.gather_info.outputs.vcs_ref }}
BUILD_DATE=${{ needs.gather_info.outputs.build_date }}
VCS_URL=https://github.com/${{ github.repository }}
VERSION=${{ needs.gather_info.outputs.version }}
- name: Build and push benji-k8s container image
uses: docker/build-push-action@v3
with:
context: .
file: ./images/benji-k8s/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/benji-k8s:latest
ghcr.io/${{ github.repository_owner }}/benji-k8s:${{ needs.gather_info.outputs.version }}
ghcr.io/${{ github.repository_owner }}/benji-k8s:${{ needs.gather_info.outputs.branch }}
build-args: |
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/benji
BASE_TAG=${{ needs.gather_info.outputs.branch }}
VCS_REF=${{ needs.gather_info.outputs.vcs_ref }}
BUILD_DATE=${{ needs.gather_info.outputs.build_date }}
VCS_URL=https://github.com/${{ github.repository }}
VERSION=${{ needs.gather_info.outputs.version }}
#
# Job: build_container_images_testing
#
build_container_images_testing:
name: "Build and publish container images for testing"
needs:
- gather_info
if: "needs.gather_info.outputs.release == 'false'"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository files
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_REGISTRY_PAT }}
- name: Build and push benji container image
uses: docker/build-push-action@v3
with:
context: .
file: ./images/benji/Dockerfile
platforms: linux/amd64
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/benji:${{ needs.gather_info.outputs.branch }}
cache-to: type=inline
tags: |
ghcr.io/${{ github.repository_owner }}/benji:${{ needs.gather_info.outputs.branch }}
build-args: |
VCS_REF=${{ needs.gather_info.outputs.vcs_ref }}
BUILD_DATE=${{ needs.gather_info.outputs.build_date }}
VCS_URL=https://github.com/${{ github.repository }}
VERSION=${{ needs.gather_info.outputs.version }}
- name: Build and push benji-k8s container image
uses: docker/build-push-action@v3
with:
context: .
file: ./images/benji-k8s/Dockerfile
platforms: linux/amd64
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/benji-k8s:${{ needs.gather_info.outputs.branch }}
cache-to: type=inline
tags: |
ghcr.io/${{ github.repository_owner }}/benji-k8s:${{ needs.gather_info.outputs.branch }}
build-args: |
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/benji
BASE_TAG=${{ needs.gather_info.outputs.branch }}
VCS_REF=${{ needs.gather_info.outputs.vcs_ref }}
BUILD_DATE=${{ needs.gather_info.outputs.build_date }}
VCS_URL=https://github.com/${{ github.repository }}
VERSION=${{ needs.gather_info.outputs.version }}
#
# Job: build_pypi_artifacts_release
#
build_pypi_artifacts_release:
name: "Build PyPI artifacts for release"
needs:
- gather_info
- tests
- lint_chart
if: "needs.gather_info.outputs.release == 'true'"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository files
uses: actions/checkout@v3
with:
# This is needed so we can determine the version properly from git history.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install tools for generating the PyPI artifacts
shell: bash
run: |
pip install --upgrade setuptools pip
pip install --upgrade build
pip freeze
- name: Build PyPI artifacts
shell: bash
run: |
python -m build --sdist --wheel --outdir dist/ .
ls -al dist/
env:
BENJI_VERSION_OVERRIDE: "${{ needs.gather_info.outputs.public_version }}"
- name: Publish artifacts to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}
#
# Job: build_pypi_artifacts_testing
#
build_pypi_artifacts_testing:
name: "Build PyPI artifacts for testing"
needs:
- gather_info
if: "needs.gather_info.outputs.release == 'false'"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository files
uses: actions/checkout@v3
with:
# This is needed so we can determine the version properly from git history.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install tools for generating the PyPI artifacts
shell: bash
run: |
pip install --upgrade setuptools pip
pip install --upgrade build
pip freeze
- name: Build PyPI artifacts
shell: bash
run: |
python -m build --sdist --wheel --outdir dist/ .
ls -al dist/
env:
BENJI_VERSION_OVERRIDE: "${{ needs.gather_info.outputs.public_version }}"
- name: Publish artifacts to PyPI test
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true