-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (157 loc) · 6.92 KB
/
generate.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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'