Skip to content

ci: change condition for pypi publish #36

ci: change condition for pypi publish

ci: change condition for pypi publish #36

Workflow file for this run

# Continuous Integration / Continuous Delivery
name: CI/CD Pipeline
# Triggers only on v* Tags
on:
push:
tags:
- v*
# temporary trigger on all pushes to debug
branches:
- '**'
# env: # Note: not available at compile time to use, ie in 'if' conditions or 'with'
jobs:
# RUN TEST SUITE ON ALL PLATFORMS
test_n_build:
if: ${{ vars.TEST_JOB_ON != 'false' && !contains(github.event.head_commit.message, '_CI_SKIP_') }}
uses: boromir674/automated-workflows/.github/workflows/test_build.yml@develop
with:
# Spawn Job per combination of factors in JOB_MATRIX
# Python 3.7 has reached End of Life (EOL) on June 27th, 2023
# Python 3.12 is in bugfix mode, same as 3.11 -> can start supporting 3.12 it
job_matrix: '{"platform": ["ubuntu-latest"], "python-version": ["3.10", "3.11", "3.12"]}'
build_installation: 'wheel' # Verify sdist and wheel installations/"builds" against Tests
# typecheck_policy: '1' # {0: Skip, 1: Run, 2: Run and allow failures}
# run_policy: '0' # Force skip of downstream 'test_build' Test Job
# artifact_name: 'BUILD_ARTIFACT'
codecov_coverage_host:
needs: test_n_build
if: ${{ vars.CODECOV_JOB_ON != 'false' && !contains(github.event.head_commit.message, '_CI_SKIP_') }}
uses: ./.github/workflows/codecov-upload.yml
with:
coverage_artifact: ${{ needs.test_n_build.outputs.COVERAGE_ARTIFACT }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
### STATIC CODE ANALYSIS & LINTING ###
lint:
name: Static Code Analysis
if: ${{ vars.LINT_JOB_ON != 'false' && !contains(github.event.head_commit.message, '_CI_SKIP_') }}
uses: ./.github/workflows/lint.yml
with:
run_policy: '2'
dedicated_branches: 'main, master, dev'
source_code_targets: 'src,tests,scripts'
python_version: '3.11'
pylint_threshold: '8.2'
### DOCS BUILD/TEST - DOCUMENTATION SITE ###
docs:
name: Build Documentation
uses: boromir674/automated-workflows/.github/workflows/policy_docs.yml@v1.15.0
with:
run_policy: '2'
python_version: '3.11'
command: 'REQS_FILE=reqs-docs.txt tox -e pin-deps -- -E docs && tox -e docs -vv -s false'
### DRAW PYTHON DEPENDENCY GRAPHS ###
code_visualization:
name: Code Visualization of Python Imports as Graphs, in .svg
if: ${{ vars.CODE_VIZ_JOB_ON != 'false' }}
uses: boromir674/automated-workflows/.github/workflows/python_imports.yml@v1.15.0
with:
run_policy: ${{ vars.CODE_VIZ_JOB_ON == 'true' && '1' || vars.CODE_VIZ_POLICY || '2' }}
branches: 'main, master, dev'
source_code_targets: 'src'
python_version: '3.11'
artifacts_dir: 'dependency-graphs'
## JOB: Signal for Automated Publishing/Deployment ##
signal_deploy:
needs: test_n_build
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
uses: ./.github/workflows/signal-deploy.yml
with:
main_branch: main
release_branch: release
## JOB: PYPI UPLOAD ##
pypi_publish:
needs: signal_deploy
uses: boromir674/automated-workflows/.github/workflows/pypi_env.yml@8e97f596067fcbbaa0a6927ec1ee47dce4ab5f1a
if: always() && vars.GH_RELEASE_JOB_ON != 'false' && (
vars.GH_RELEASE_JOB_ON == 'true' ||
needs.signal_deploy.outputs.AUTOMATED_DEPLOY == 'true')
with:
distro_name: cookiecutter_python
distro_version: ${{ needs.test_n_build.outputs.PEP_VERSION }}
pypi_env: '${{ needs.signal_deploy.outputs.ENVIRONMENT_NAME }}'
require_wheel: true
allow_existing: true
should_trigger: ${{ needs.signal_deploy.outputs.AUTOMATED_DEPLOY == 'true' }}
secrets:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
### JOB: Make a Github Release ###
gh_release:
needs: signal_deploy
if: vars.GH_RELEASE_JOB_ON != 'false' && (
vars.GH_RELEASE_JOB_ON == 'true' ||
needs.signal_deploy.outputs.AUTOMATED_DEPLOY == 'true')
uses: boromir674/automated-workflows/.github/workflows/gh-release.yml@v1.15.0
name: 'GH Release'
with:
tag: ${{ github.ref_name }}
# artifact: 'BUILD_ARTIFACT' # do not include a tarball/wheel artifact in the GH Release
draft: ${{ needs.signal_deploy.outputs.ENVIRONMENT_NAME == 'TEST_DEPLOYMENT' }}
secrets:
# passing the GH_TOKEN PAT, to render in GH as User, instead of bot
gh_token: ${{ secrets.GH_TOKEN }}