Improve versioning scheme for soon and edge trains (#96)

Co-authored-by: Peter McEvoy <git@mcevoypeter.com>
This commit is contained in:
Peter McEvoy 2023-01-11 15:13:18 -05:00 committed by GitHub
parent 15c0328734
commit 1a23de4464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 40 deletions

View File

@ -91,7 +91,7 @@ jobs:
- name: Build binary
run: |
echo "${{ inputs.pace }}" > ./pkg/vere/PACE
echo "${{ inputs.pace }}" > ./PACE
case "${{ matrix.target }}" in
"linux-aarch64")
bazel build --platforms=//:linux-aarch64 :urbit
@ -146,7 +146,7 @@ jobs:
- name: Upload binary to bootstrap.urbit.org
if: ${{ inputs.upload }}
run: |
version="$(cat ./pkg/vere/VERSION)"
version="$(cat ./VERSION)"
target="gs://${UPLOAD_BASE}/${{ inputs.pace }}/v${version}/vere-v${version}-${{ matrix.target }}"
# See https://github.com/urbit/vere/issues/86.
@ -228,7 +228,7 @@ jobs:
- name: Build and push Docker image
if: ${{ inputs.docker && matrix.target == 'linux-x86_64' }}
run: |
version="v$(cat ./pkg/vere/VERSION)"
version="v$(cat ./VERSION)"
tag="$version-${{ inputs.pace }}"
bazel run :upload_docker
@ -253,13 +253,13 @@ jobs:
target="gs://${UPLOAD_BASE}/${{ inputs.pace }}/last"
# See https://github.com/urbit/vere/issues/86.
if [[ $(cat ./pkg/vere/VERSION) == "1.16" ]]; then
gsutil cp ./pkg/vere/VERSION "gs://${UPLOAD_BASE}/${{ inputs.pace }}/1.15/next"
if [[ $(cat ./VERSION) == "1.16" ]]; then
gsutil cp ./VERSION "gs://${UPLOAD_BASE}/${{ inputs.pace }}/1.15/next"
fi
# We don't use -n here because we want to overwrite the version
# string.
gsutil cp ./pkg/vere/VERSION "$target"
gsutil cp ./VERSION "$target"
[ $exitcode -eq 0 ] &&
echo "Upload to $target completed successfully." ||

View File

@ -126,6 +126,47 @@ platform(
],
)
# Produce the `U3_VERE_PACE` macro.
genrule(
name = "pace",
srcs = ["PACE"],
outs = ["pace.h"],
cmd = """
echo '#ifndef URBIT_PACE_H' > $@
echo '#define URBIT_PACE_H' >> $@
printf '#define U3_VERE_PACE "%s"\n' $$(cat $< | tr -d '\n') >> $@
echo '#endif' >> $@
""",
visibility = ["//:__subpackages__"],
)
# Produce the `URBIT_VERSION` macro.
genrule(
name = "version",
srcs = [
# Bazel warns dependency checking directories is unsound, but there's no
# apparent way around depending on .git if we want to run git commands.
".git",
"PACE",
"VERSION",
],
outs = ["version.h"],
cmd = """
version_num=`cat $(execpath VERSION) | tr -d '\n'`
commit_sha=`git rev-parse --short HEAD`
if [ `tr -d '\n' < $(execpath PACE)` == "live" ]; then
version="$$version_num"
else
version="$$version_num-$$commit_sha"
fi
echo '#ifndef URBIT_VERSION_H' > $@
echo '#define URBIT_VERSION_H' >> $@
printf '#define URBIT_VERSION "%s"\n' $$version >> $@
echo '#endif' >> $@
""",
visibility = ["//:__subpackages__"],
)
alias(
name = "urbit",
actual = "//pkg/vere:urbit",

1
PACE Normal file
View File

@ -0,0 +1 @@
once

1
VERSION Normal file
View File

@ -0,0 +1 @@
1.17

View File

@ -2,8 +2,6 @@
# GENERATED FILES
#
exports_files(["PACE", "VERSION"])
# An approximation of `xxd -i` that runs on all platforms where Bash is
# present. Generates a `.h` file that declares the array and array length as
# `extern` global variables and a `.c` file containing the array and array
@ -84,34 +82,6 @@ genrule(
visibility = ["//visibility:private"],
)
# Produce the `URBIT_VERSION` macro.
genrule(
name = "version",
srcs = ["VERSION"],
outs = ["version.h"],
cmd = """
echo '#ifndef URBIT_VERSION_H' > $@
echo '#define URBIT_VERSION_H' >> $@
printf '#define URBIT_VERSION "%s"\n' $$(cat $<) >> $@
echo '#endif' >> $@
""",
visibility = ["//visibility:private"],
)
# Produce the `U3_VERE_PACE` macro.
genrule(
name = "pace",
srcs = ["PACE"],
outs = ["pace.h"],
cmd = """
echo '#ifndef URBIT_PACE_H' > $@
echo '#define URBIT_PACE_H' >> $@
printf '#define U3_VERE_PACE "%s"\n' $$(cat $<) >> $@
echo '#endif' >> $@
""",
visibility = ["//visibility:private"],
)
#
# LIBRARIES
#
@ -132,8 +102,8 @@ cc_library(
],
) + [
":ivory",
":pace",
":version",
"//:pace",
"//:version",
] + select({
"@platforms//os:macos": [
"platform/darwin/daemon.c",
@ -174,8 +144,8 @@ cc_binary(
"main.c",
":ca_bundle",
":ivory",
":pace",
":version",
"//:pace",
"//:version",
],
features = select({
"@platforms//os:linux": ["fully_static_link"],