Skip to content

Sets explicit "nightly" suffix for GitHub nightly builds#1903

Merged
pfeerick merged 2 commits intomainfrom
verstr_nightly
Apr 26, 2022
Merged

Sets explicit "nightly" suffix for GitHub nightly builds#1903
pfeerick merged 2 commits intomainfrom
verstr_nightly

Conversation

@rotorman
Copy link
Member

Tries to augment #1850, #1887 and #1895 by adding explicit "nightly" suffix for GitHub nightly builds.
Real-life testing possible likely only after merging and waiting for the nightly to be generated.

@rotorman rotorman added the enhancement ✨ New feature or request label Apr 26, 2022
@rotorman rotorman requested a review from pfeerick April 26, 2022 08:29
@pfeerick
Copy link
Member

Can always run it locally... EDGETX_VERSION_SUFFIX=nightly FLAVOR=tx16s tools/build-gh.sh ;)

image
image
image

GITHUB_REF=refs/tags/v2.7.0 FLAVOR=tx16s tools/build-gh.sh
GITHUB_REF=refs/pull/1234/merge FLAVOR=tx16s tools/build-gh.sh
GITHUB_REF=refs/heads/numtest FLAVOR=tx16s tools/build-gh.sh

I was thinking perhaps more like this... i.e. don't even do any of the processing if it's already set?

diff --git a/tools/build-gh.sh b/tools/build-gh.sh
index 2a00c1fcd..fa612f911 100755
--- a/tools/build-gh.sh
+++ b/tools/build-gh.sh
@@ -48,25 +48,28 @@ fi
 
 : ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
 
-gh_type=$(echo "$GITHUB_REF" | awk -F / '{print $2}') #heads|tags|pull
-
-if [[ $gh_type = "tags" ]]; then
-  # tags: refs/tags/<tag_name>
-  gh_tag=${GITHUB_REF##*/}
-  export EDGETX_VERSION_TAG=$gh_tag
-elif [[ $gh_type = "pull" ]]; then
-  # pull: refs/pull/<pr_number>/merge
-  gh_pull_number=PR$(echo "$GITHUB_REF" | awk -F / '{print $3}')
-  export EDGETX_VERSION_SUFFIX=$gh_pull_number
-elif [[ $gh_type = "heads" ]]; then
-  # heads: refs/heads/<branch_name>
-  # replace it with branch_name only, if EDGETX_VERSION_SUFFIX is already not set
-  if [[ -z ${EDGETX_VERSION_SUFFIX} ]]; then
+# Generate EDGETX_VERSION_SUFFIX if not already set
+if [[ -z ${EDGETX_VERSION_SUFFIX} ]]; then
+    gh_type=$(echo "$GITHUB_REF" | awk -F / '{print $2}') #heads|tags|pull
+
+    if [[ $gh_type = "tags" ]]; then
+    # tags: refs/tags/<tag_name>
+    gh_tag=${GITHUB_REF##*/}
+    export EDGETX_VERSION_TAG=$gh_tag
+    elif [[ $gh_type = "pull" ]]; then
+    # pull: refs/pull/<pr_number>/merge
+    gh_pull_number=PR$(echo "$GITHUB_REF" | awk -F / '{print $3}')
+    export EDGETX_VERSION_SUFFIX=$gh_pull_number
+    elif [[ $gh_type = "heads" ]]; then
+    # heads: refs/heads/<branch_name>
     gh_branch=${GITHUB_REF##*/}
     export EDGETX_VERSION_SUFFIX=$gh_branch
-  fi
-fi
 
+    fi
+fi
+echo $EDGETX_VERSION_TAG #testing only
+echo $EDGETX_VERSION_SUFFIX #testing only
+exit #testing only
 : ${BUILD_TYPE:=Release}
 : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev "}
 : ${EXTRA_OPTIONS:="$EXTRA_OPTIONS"}

@rotorman
Copy link
Member Author

I like the idea of setting EDGETX_VERSION_SUFFIX only, if not already explicitly set, so changed to your suggestion. Please see last commit, if worthy for merging. Thx!

@pfeerick pfeerick added the compilation Related to compiling the firmware and firmware options label Apr 26, 2022
@pfeerick pfeerick added this to the 2.8 milestone Apr 26, 2022
Copy link
Member

@pfeerick pfeerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge on PR check ✅ Then we get to wait and see if everything works as planned in 16 or so hours 😁

@pfeerick pfeerick merged commit f2b07dd into main Apr 26, 2022
@pfeerick pfeerick deleted the verstr_nightly branch April 26, 2022 10:44
@pfeerick
Copy link
Member

Just loaded the nightly for the Zorro, is correctly marked as nightly :)

@rotorman
Copy link
Member Author

Indeed, looking good. Tests with TX16S mkII:

From this PR:

grafik

Action result, after this PR was merged and I flashed the binary that was built in GitHub:

grafik

Today's nightly:

grafik

😄

I wonder though, if we should now revert the change I introduced in #1850 to:
https://github.com/EdgeTX/edgetx/blob/main/tools/build-companion-release.sh#L40-L41

@pfeerick
Copy link
Member

I'd have to have a proper look, but I think so. Tag existence should trigger any "release" logic thus no need for the suffix to be set to release. The next thing to check up on now is how Companion shows the version, so might as well do that all in one PR.

@rotorman
Copy link
Member Author

Started testing with Companion.

When building current main locally with MSYS2, this is the output under Windows:
grafik

(this should ideally have a selfbuild suffix)

And this is the output of the self-built Windows TX16S Simulator library:

grafik

Next, downloaded Windows Companion binary from https://github.com/EdgeTX/edgetx/actions/runs/2232773279 (main branch GitHub build):

grafik

As TX16S simu lib is presently not included in Windows Companion installer package (bug), tried with Zorro:

grafik

(notice the wrong -selfbuild suffix).

rotorman added a commit that referenced this pull request Apr 27, 2022
* Sets explicit "nightly" suffix for GitHub nightly builds.

* Extract and set EDGETX_VERSION_SUFFIX only, if not already set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compilation Related to compiling the firmware and firmware options enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants