Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement proper git SHA ID marking for builds during pull-requests #1772

Merged
merged 26 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: CI
on: [push, pull_request]

jobs:


build:
runs-on: ubuntu-20.04
container:
Expand All @@ -26,6 +28,9 @@ jobs:
- name: Git ownership exception
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 }}
run: cd source && ./build.sh -m ${{ matrix.model }}

Expand Down Expand Up @@ -76,6 +81,9 @@ jobs:
- name: Git ownership exception
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 }}
run: make -C source/ -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese

Expand Down
1 change: 1 addition & 0 deletions Documentation/DebugMenu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- B - git-related custom **b**ranch
- 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)
- S - something **s**pecial[^ERR]
- V - something **v**ery special[^ERR]
Expand Down
9 changes: 9 additions & 0 deletions Translations/make_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,14 @@ def get_translation_sanity_checks_text(defs: dict) -> 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("")

try:
# 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!)
Expand Down Expand Up @@ -1299,9 +1306,11 @@ def get_version_suffix(ver) -> str:
except OSError:
# Something _special_?
suffix = "S"

if "" == suffix:
# Something _very_ special!
suffix = "V"

return suffix


Expand Down