feat: make Gold Standard Python Project pass Pylint Job on CI #418
This file contains 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 . | |
# ## 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: | | |
# GEN_CI_CONFIG=gen/biskotaki/.github/workflows/test.yaml | |
# 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: | | |
# tox -e pin-deps -- -E docs # poetry export | |
# 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' | |
## 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: | | |
tox -e pin-deps -- -E docs # poetry export | |
tox -e docs | |
# 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' |