Skip to content

Bump gevent from 23.7.0 to 23.9.1 #24

Bump gevent from 23.7.0 to 23.9.1

Bump gevent from 23.7.0 to 23.9.1 #24

Workflow file for this run

name: Python Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types:
- created
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get version values
id: vars
run: |
echo ::set-output name=version::$(cat src/tpt/data/VERSION)
echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Show captured versions
run: |
echo 'Version in source code: ${{ steps.vars.outputs.version }}'
echo 'Release version: ${{ steps.vars.outputs.tag }}'
- name: Check version tag
uses: nick-invision/assert-action@v1.1.0
if: github.event_name == 'release'
with:
expected: ${{ steps.vars.outputs.tag }}
actual: ${{ steps.vars.outputs.version }}
comparison: exact
build:
needs: check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get version value
id: vars
run: |
echo ::set-output name=version::$(cat src/tpt/data/VERSION)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pip-tools pytest-mock mock pytest-cov pytest-dependency pytest-celery sqlalchemy
if [ -f requirements.in ]; then pip-compile; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install TeSLA CE TPT Package
run: |
python setup.py install
- name: Test with pytest
run: |
pytest --cov=tpt
env:
SECRET: SECRET
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v1.5.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
PYTHON: ${{ matrix.python-version }}
with:
fail_ci_if_error: true
env_vars: PYTHON
- name: Export coverage and lint data for SonarQube
if: matrix.python-version == 3.9
run: |
# Generate XML report
coverage xml
# Replace the file paths to fit with source paths instead of installed package paths
sed -i 's+${{ env.LD_LIBRARY_PATH }}/python${{ matrix.python-version }}/site-packages/tpt-${{ steps.vars.outputs.version }}-py${{ matrix.python-version }}.egg+src+g' coverage.xml
# Perform PyLint Analysis
python -m pip install pyflakes pylint
pylint --exit-zero --max-line-length=120 src/tpt tests/ -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" | tee pylint.txt
# Set the current version to SonarQube configuration file
echo 'sonar.projectVersion=${{ steps.vars.outputs.version }}' >> sonar-project.properties
- name: SonarQube analysis
uses: docker://sonarsource/sonar-scanner-cli:latest
if: matrix.python-version == 3.9
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: Fossa update license analysis
if: matrix.python-version == 3.9
uses: fossa-contrib/fossa-action@v1
continue-on-error: true
with:
fossa-api-key: ${{ secrets.FOSSA_API_KEY }}
publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Store version
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Build package
run: |
# Build requirements
python -m pip install --upgrade pip
python -m pip install pip-tools twine
if [ -f requirements.in ]; then pip-compile; fi
# Set the version
echo '${{ steps.vars.outputs.tag }}' > src/tpt/data/VERSION
# Build wheel
python setup.py sdist bdist_wheel
# Publish the package
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
docker_tag:
needs: publish
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Store version
id: vars
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.5.0
with:
push: true
tags: teslace/provider-pt-tpt:${{ steps.vars.outputs.tag }}, teslace/provider-pt-tpt:latest
file: docker/Dockerfile
build-args: TESLA_CE_PROVIDER_VERSION=${{ steps.vars.outputs.tag }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
docker_edge:
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'release'
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Store version
id: vars
run: |
echo ::set-output name=version::$(cat src/tpt/data/VERSION)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push edge image
run: |
# Build requirements
python -m pip install --upgrade pip
python -m pip install pip-tools wheel testresources
pip-compile
# Set the version
echo '${{ steps.vars.outputs.version }}' > src/tpt/data/VERSION
# Build wheel
python setup.py bdist_wheel
# Build and publish
docker build -t teslace/provider-pt-tpt:edge -f docker/Dockerfile.edge --build-arg TESLA_CE_PROVIDER_VERSION=${{ steps.vars.outputs.version }} .
docker push teslace/provider-pt-tpt:edge