Implement proper git SHA ID marking for builds during pull-requests (#1772)
* debug github CI git meta info * fix push.yml format * fix push.yml for shell * try to fix push.yml * try to fix push.yml run * try to fix push.yml run for multi * keep debugging * try to do as less changes as possible * Implement proper git tagging for builds during pull-requests * Unify new-line separators between build steps * Keep debugging * make_translation.py: fix formatting * push.yml: try to set ENV values * push.yml: fix copy-paste error * Remove extra env var * Experimenting * Testing upper() * Re-testing upper() * Revert tested values * make_translation.py: add new lines between blocks to improve readability * Reformulate docs & comments * make_translation.py: remove debugging print * make_translation.py: simplify check for SHA ID env var / code review * make_translation.py: fix condition --------- Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>
This commit is contained in:
8
.github/workflows/push.yml
vendored
8
.github/workflows/push.yml
vendored
@@ -3,6 +3,8 @@ name: CI
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
container:
|
container:
|
||||||
@@ -26,6 +28,9 @@ jobs:
|
|||||||
- name: Git ownership exception
|
- name: Git ownership exception
|
||||||
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
|
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
|
- name: Git meta info
|
||||||
|
run: echo "GITHUB_CI_PR_SHA=${{github.event.pull_request.head.sha}}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Build ${{ matrix.model }}
|
- name: Build ${{ matrix.model }}
|
||||||
run: cd source && ./build.sh -m ${{ matrix.model }}
|
run: cd source && ./build.sh -m ${{ matrix.model }}
|
||||||
|
|
||||||
@@ -76,6 +81,9 @@ jobs:
|
|||||||
- name: Git ownership exception
|
- name: Git ownership exception
|
||||||
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
|
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
|
- name: Git meta info
|
||||||
|
run: echo "GITHUB_CI_PR_SHA=${{github.event.pull_request.head.sha}}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Build ${{ matrix.model }}
|
- name: Build ${{ matrix.model }}
|
||||||
run: make -C source/ -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese
|
run: make -C source/ -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ There is a static line on top which is presented on every sub-screen and reflect
|
|||||||
- D - git-related **d**ev branch
|
- D - git-related **d**ev branch
|
||||||
- B - git-related custom **b**ranch
|
- B - git-related custom **b**ranch
|
||||||
- G - neither above but **g**it-related
|
- G - neither above but **g**it-related
|
||||||
|
- C - build from github **C**I during _pull request_
|
||||||
- H - build outside of a git tree (i.e. release tarball or **h**omebrew customization without git)
|
- H - build outside of a git tree (i.e. release tarball or **h**omebrew customization without git)
|
||||||
- S - something **s**pecial[^ERR]
|
- S - something **s**pecial[^ERR]
|
||||||
- V - something **v**ery special[^ERR]
|
- V - something **v**ery special[^ERR]
|
||||||
|
|||||||
@@ -1264,7 +1264,14 @@ def get_translation_sanity_checks_text(defs: dict) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def get_version_suffix(ver) -> str:
|
def get_version_suffix(ver) -> str:
|
||||||
|
# Check env var from push.yml first:
|
||||||
|
# - if it's pull request then use vX.YY + C.ID for version line as in *C*I with proper tag instead of merge tag for detached tree
|
||||||
|
if os.environ.get("GITHUB_CI_PR_SHA", "") != "":
|
||||||
|
return "C" + "." + os.environ["GITHUB_CI_PR_SHA"][:8].upper()
|
||||||
|
# - no github PR SHA ID, hence keep checking
|
||||||
|
|
||||||
suffix = str("")
|
suffix = str("")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Use commands _hoping_ they won't be too new for one environments nor deprecated for another ones:
|
# Use commands _hoping_ they won't be too new for one environments nor deprecated for another ones:
|
||||||
## - get commit id; --short=8 - the shorted hash with 8 digits (increase/decrease if needed!)
|
## - get commit id; --short=8 - the shorted hash with 8 digits (increase/decrease if needed!)
|
||||||
@@ -1299,9 +1306,11 @@ def get_version_suffix(ver) -> str:
|
|||||||
except OSError:
|
except OSError:
|
||||||
# Something _special_?
|
# Something _special_?
|
||||||
suffix = "S"
|
suffix = "S"
|
||||||
|
|
||||||
if "" == suffix:
|
if "" == suffix:
|
||||||
# Something _very_ special!
|
# Something _very_ special!
|
||||||
suffix = "V"
|
suffix = "V"
|
||||||
|
|
||||||
return suffix
|
return suffix
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user