-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (130 loc) · 5.23 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
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
## GENERATE FROM TEMPLATE into gen/ ##
# ROOT : gen/biskotaki/pyproject.toml
- name: Generate Biskotaki from Template
run: |
pip install --user -e .
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 }}"
run: |
cd gen/biskotaki
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'
run: |
cd gen/biskotaki
tox -e pin-deps -- -E typing
tox -e type
- name: 'Ruff: Fast Python Linter -> PASS'
run: |
cd gen/biskotaki
tox -e ruff
# Running Lint Check, on src and Test code: Passes
- name: 'Isort, Black: Code Formatter -> PASS'
run: |
cd gen/biskotaki
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'
run: |
cd gen/biskotaki
tox -e build
# Running Quality Checks against Distro Metadata: Passes with 10/10 score
- name: 'Pyroma: Distro Quality -> PASS'
run: |
cd gen/biskotaki
tox -e check
# 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/biskotaki/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
## 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'