Skip to content

Scorecard fix

Scorecard fix #100

Workflow file for this run

name: Helm Wizard CI
on:
push:
branches: [ "main" ]
paths:
- .github/workflows/helm-wizard-ci.yaml
- deployment/resc-helm-wizard/**
- '!**.md'
- '!**.png'
- '!**.gif'
- .gitignore
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/helm-wizard-ci.yaml
- deployment/resc-helm-wizard/**
- '!**.md'
- '!**.png'
- '!**.gif'
- .gitignore
workflow_dispatch:
env:
CACHE_KEY_PREFIX: tox-dir
permissions: read-all
jobs:
python-basic-validation:
name: Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: deployment/resc-helm-wizard
strategy:
fail-fast: false
matrix:
include:
- name: Run tests with Python 3.9
python-version: "3.9"
toxenv: py
- name: Run tests with Python 3.10
python-version: "3.10"
toxenv: py
- name: Run tests with Python 3.11
python-version: "3.11"
toxenv: py
- name: Run flake8 with Python 3.11
python-version: "3.11"
toxenv: flake8
- name: Run isort with Python 3.11
python-version: "3.11"
toxenv: isort
- name: Run pylint with Python 3.11
python-version: "3.11"
toxenv: pylint
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Cache .tox directory
id: cache-tox-dir
uses: actions/cache@v3.3.1
with:
path: deployment/resc-helm-wizard/.tox
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version
}}-${{ env.CACHE_KEY_PREFIX }}-${{
hashFiles('deployment/resc-helm-wizard/setup.cfg', 'deployment/resc-helm-wizard/test-requirements.txt', 'deployment/resc-helm-wizard/tox.ini') }}
- name: Install tox
run: pip install -U pip setuptools tox
- name: Create ${{ matrix.python-version }} tox env. and install dependencies
if: steps.cache-tox-dir.outputs.cache-hit != 'true'
run: |
tox run -e ${{ matrix.toxenv }} --notest
- name: Test
run: |
tox run -e ${{ matrix.toxenv }}
- name: Get Branch Name
id: extract_branch
run: |
if [[ ${GITHUB_EVENT_NAME} == 'pull_request' ]]; then
export BRANCH_NAME="${GITHUB_HEAD_REF}"
echo "::set-output name=branch_name::${BRANCH_NAME}"
elif [[ ${GITHUB_EVENT_NAME} == 'push' ]]; then
export BRANCH_NAME="${GITHUB_REF_NAME}"
echo "::set-output name=branch_name::${BRANCH_NAME}"
else
echo "Event is neither pull_request nor push"
fi
outputs:
branch_name: ${{ steps.extract_branch.outputs.branch_name }}
python-build-and-publish:
name: Python Build and Publish
needs: python-basic-validation
runs-on: ubuntu-latest
defaults:
run:
working-directory: deployment/resc-helm-wizard
strategy:
matrix:
python-version: ["3.9"]
outputs:
wizard_version: ${{ steps.getversion.outputs.wizard_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Building python package
run: |
python -m pip install --upgrade pip build
python -m build
- name: Publish python package to PyPI
if: ${{ needs.python-basic-validation.outputs.branch_name == 'main' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.__PYPI_TOKEN__ }}
packages_dir: deployment/resc-helm-wizard/dist
skip-existing: true
- id: getversion
name: Get package version
run: |
wizard_version=$(python ./setup.py --version)
echo "wizard_version=$wizard_version" >> $GITHUB_OUTPUT