Release 2.6.3 to production #500
This file contains hidden or 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: Generate from Template and Commit to Biskotaki | |
on: | |
push: | |
branches: | |
- update-generate | |
pull_request: | |
branches: | |
- 'master' | |
env: | |
PY_VERSION: '3.11' | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
env: | |
branch: auto-generated | |
SUPER_SECRET: ${{ secrets.BISKOTAKI_GH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PY_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ env.PY_VERSION }}" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install 'tox<4' | |
# For tox -e graphs (aka Pydeps) | |
# sudo apt update -y && sudo apt install -y aptitude | |
# sudo aptitude install -y graphviz | |
## CLONE BISKOTAKI REPO into cloned/biskotaki ## | |
# ROOT : cloned/biskotaki/pyproject.toml | |
- name: Clone Biskotaki repo | |
uses: actions/checkout@v4 | |
with: | |
repository: boromir674/biskotaki | |
ref: ${{ env.branch }} | |
path: 'cloned/biskotaki' | |
- name: Find Biskotaki version | |
run: | | |
cd cloned/biskotaki | |
echo "PKG_VERSION=$(python scripts/parse_version.py)" >> $GITHUB_ENV | |
# INSTALL `generate-python` CLI | |
- name: Install `generate-python` CLI | |
run: pip install --user -e . | |
##### TEST 1: Generated Project with ./.github/biskotaki.yaml as User Config ##### | |
# ## GENERATE FROM TEMPLATE into gen/ ## | |
# # ROOT : gen/biskotaki/pyproject.toml | |
# - name: Generate Biskotaki from Template | |
# run: | | |
# echo " version: \"${{ env.PKG_VERSION }}\"" >> .github/biskotaki.yaml | |
# generate-python -o gen --config-file ./.github/biskotaki.yaml --no-input -f --offline | |
# ## VALIDATE BISKOTAKI CI CONFIG file is in valid Yaml format ## | |
# - name: "Validate YAML format" | |
# run: | | |
# # At the moment the genraot can create 2 different designs of CI Pipeline | |
# old_design=gen/biskotaki/.github/workflows/test.yaml | |
# new_design=gen/biskotaki/.github/workflows/cicd.yml | |
# # use whichever exists, else exit with error | |
# GEN_CI_CONFIG=$([ -f $new_design ] && echo $new_design || echo $old_design) | |
# # if file not exists explicitly exit with error | |
# if [ ! -f "$GEN_CI_CONFIG" ]; then | |
# echo "ERROR: $GEN_CI_CONFIG does not exist" | |
# exit 1 | |
# fi | |
# if [ ! $(yq eval 'true' "$GEN_CI_CONFIG") ]; then | |
# echo "ERROR: $GEN_CI_CONFIG is malformed" | |
# exit 1 | |
# fi | |
# ## Run Test Suite against the generated project ## | |
# - name: Test distributions 'Source', 'Built' and 'edit' (dev env) mode installation | |
# env: | |
# TOXPYTHON: "python${{ env.PY_VERSION }}" | |
# working-directory: gen/biskotaki | |
# run: | | |
# tox -e 'edit,sdist,wheel' | |
# tox -e wheel-test | |
# tox -e coverage | |
# ## Verify all Tox Envs PASS, as intented, out of the box ## | |
# # Running Type Check, on src and Test code: Passes | |
# - name: 'Mypy: Static Type Checker -> PASS' | |
# working-directory: gen/biskotaki | |
# run: | | |
# tox -e pin-deps -- -E typing | |
# tox -e type | |
# - name: 'Ruff: Fast Python Linter -> PASS' | |
# working-directory: gen/biskotaki | |
# run: tox -e ruff | |
# # Running Lint Check, on src and Test code: Passes | |
# - name: 'Isort, Black: Code Formatter -> PASS' | |
# working-directory: gen/biskotaki | |
# run: tox -e lint | |
# # Running the Build script (sdist and wheel): produces Distro Artifacts: Source (.tar.gz) and Wheel (.whl) files | |
# - name: 'Build: sdist, wheel -> PASS' | |
# working-directory: gen/biskotaki | |
# run: tox -e build | |
# # Running Quality Checks against Distro Metadata: Passes with 10/10 score | |
# - name: 'Pyroma: Distro Quality -> PASS' | |
# working-directory: gen/biskotaki | |
# run: tox -e check | |
# # Docs Checks: Run Build Docs command, and verify it succeeds | |
# - name: 'Sphinx: Build Docs Web Site (html/css/js) -> PASS' | |
# working-directory: gen/biskotaki | |
# run: | | |
# echo "[INFO] Exporting to pip-installable Requirements for Docs" | |
# tox -e pin-deps -- -E docs # poetry export | |
# echo "[INFO] Building Docs" | |
# tox -e docs | |
# - name: Remove requirements file generated with 'poetry export' for Docs | |
# # See tox.ini -> testenv.setenv.DEFAULT_REQS_FILE | |
# run: rm -f gen/biskotaki/reqs.txt | |
# # tox -e graphs | |
# ## PUSH to BISKOTAKI REPO ## | |
# - name: Push to dedicated branch in biskotaki repo | |
# # Pin to v1.7.2 -> 07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 | |
# uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 | |
# env: | |
# SSH_DEPLOY_KEY: ${{ secrets.SSH_GITHUB_KEY }} | |
# with: | |
# source-directory: 'gen/biskotaki' | |
# destination-github-username: 'boromir674' | |
# destination-repository-name: 'biskotaki' | |
# user-email: [email protected] | |
# user-name: 'Konstantinos' | |
# destination-repository-username: 'boromir674' | |
# target-branch: ${{ env.branch }} | |
# commit-message: 'apply Template from https://github.com/boromir674/cookiecutter-python-package' | |
##### TEST 2: Generated Project with ./.github/biskotaki.yaml as User Config ##### | |
## GENERATE Python GOLD STANDARD from TEMPLATE into gen/ ## | |
# ROOT : gen-gold/biskotaki-gold-standard/pyproject.toml | |
- name: Generate Python Gold Standard Biskotaki from Template | |
env: | |
USER_CONFIG: tests/data/gold-standard.yml | |
run: | | |
echo " version: \"${{ env.PKG_VERSION }}\"" >> ${{ env.USER_CONFIG }} | |
generate-python -o gen-gold --config-file "${{ env.USER_CONFIG }}" --no-input -f --offline | |
# Generate poetry.lock to include in the Pushed Files | |
- name: Generate Poetry.lock | |
run: | | |
pip install pipx | |
pipx install poetry | |
poetry lock | |
working-directory: gen-gold/biskotaki-gold-standard | |
# MKDOCS Checks: Run Build Docs command, and verify it succeeds ## | |
- name: 'Mkdocs: Build Docs Web Site (html/css/js) -> PASS' | |
working-directory: gen-gold/biskotaki-gold-standard | |
run: | | |
virtualenv env --python='python${{ env.PY_VERSION }}' | |
source env/bin/activate | |
echo "[INFO] Installing Rolling Requirements for Docs" | |
pip install -e .[docs] | |
echo "[INFO] Building the Docs" | |
mkdocs build | |
- run: | | |
source env/bin/activate | |
pip list | |
working-directory: gen-gold/biskotaki-gold-standard | |
# echo "[INFO] Exporting to pip-installable Requirements for Docs" | |
# [ OPT 2 ] | |
# # unless we pin colorama in poetry.lock we | |
# # export the requirements without hashes | |
# tox -e pin-deps -- -E docs --without-hashes | |
# echo "[INFO] Building Docs" | |
# # pipx install virtualenv | |
# virtualenv env --python='python${{ env.PY_VERSION }}' | |
# source env/bin/activate | |
# echo "[INFO] Installing Pinned Requirements for Docs" | |
# # unless we pin colorama in poetry.lock it will fail if not 'poetry add' used | |
# pip install -r reqs.txt | |
# echo "[INFO] Installing the Package with 'docs' extras" | |
# pip install -e .[docs] | |
# echo "[INFO] Building the Docs" | |
# mkdocs build | |
# [ OPT 1 ] | |
# # tox -e docs | |
# [ OPT 3 ] | |
# BOTH tox and poetry based method have become unmaintanable | |
# We introduce a docker-based Mkdocs build and test | |
# exlude 'site' dir from pushing to biskotaki repo | |
- name: Exclude 'site' folder, built with Mkdocs, from 'git push' | |
run: rm -rf gen-gold/biskotaki-gold-standard/site | |
# exlude 'reqs.txt' file, generated with 'poetry export' for Docs | |
- name: Exclude 'reqs.txt' file, generated with 'poetry export' for Docs | |
# See tox.ini -> testenv.setenv.DEFAULT_REQS_FILE | |
run: rm -f gen-gold/biskotaki-gold-standard/reqs.txt | |
## PUSH the Python Gold Standard to BISKOTAKI REPO ## | |
- name: Push to dedicated branch in biskotaki repo | |
# Pin to v1.7.2 -> 07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 | |
uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_GITHUB_KEY }} | |
with: | |
source-directory: 'gen-gold/biskotaki-gold-standard' | |
destination-github-username: 'boromir674' | |
destination-repository-name: 'biskotaki' | |
user-email: [email protected] | |
user-name: 'Konstantinos' | |
destination-repository-username: 'boromir674' | |
target-branch: py-gold | |
commit-message: 'apply Template from https://github.com/boromir674/cookiecutter-python-package' |