Skip to content

Commit

Permalink
Release v1.17 (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter McEvoy authored Jan 18, 2023
2 parents 4f4b01b + 1430c72 commit eda117a
Show file tree
Hide file tree
Showing 61 changed files with 1,286 additions and 968 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: Push to develop

on:
release: null
push:
branches:
- develop
paths:
- '*.bazel'
- '.bazelrc'
- '.github/workflows/**.yml'
- 'PACE'
- 'VERSION'
- 'bazel/**'
- 'pkg/**'

jobs:
urbit:
uses: ./.github/workflows/shared.yml
with:
docker: true
pace: 'edge'
upload: true
secrets: inherit
10 changes: 9 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: Push to master

on:
release: null
push:
branches:
- master
paths:
- '*.bazel'
- '.bazelrc'
- '.github/workflows/**.yml'
- 'PACE'
- 'VERSION'
- 'bazel/**'
- 'pkg/**'


jobs:
urbit:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: Push to release

on:
release: null
push:
branches:
- release
paths:
- '*.bazel'
- '.bazelrc'
- '.github/workflows/**.yml'
- 'PACE'
- 'VERSION'
- 'bazel/**'
- 'pkg/**'

jobs:
urbit:
uses: ./.github/workflows/shared.yml
with:
docker: true
pace: 'soon'
upload: true
secrets: inherit
45 changes: 27 additions & 18 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
fail-fast: false
matrix:
include:
- { target: linux-aarch64, runner: ubuntu-22.04 }
# GitHub doesn't provide AArch64 Linux machines, so we self-host a
# runner instead.
- { target: linux-aarch64, runner: [self-hosted, Linux, ARM64] }
- { target: linux-x86_64, runner: ubuntu-22.04 }
# GitHub doesn't provide M1 macOS machines, so we self-host a runner
# instead.
Expand All @@ -49,9 +51,12 @@ jobs:
- uses: actions/checkout@v3

- name: chown /usr/local
if: ${{ matrix.target == 'linux-aarch64' || matrix.target == 'linux-x86_64' }}
if: ${{ matrix.target == 'linux-x86_64' }}
run: |
# See https://github.com/actions/cache/issues/845.
# See https://github.com/actions/cache/issues/845. Note we don't run
# this on linux-aarch64 because we run on a self-hosted GitHub Actions
# runner for which `/usr/local` has already been `chown`d to the user
# running the GitHub Actions runner.
sudo chown -R $(whoami) /usr/local
- name: Set up build cache
Expand Down Expand Up @@ -91,10 +96,10 @@ 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
bazel build :urbit
;;
"linux-x86_64")
bazel build :urbit
Expand All @@ -108,9 +113,6 @@ jobs:
esac
- name: Run unit tests
# We have no way of running the linux-aarch64 tests on a linux-x86_64
# machine.
if: ${{ matrix.target != 'linux-aarch64' }}
run: |
if [[ "${{ matrix.target }}" == "macos-x86_64" ]]; then
bazel test --build_tests_only --clang_version=14.0.6 --extra_toolchains=//bazel/toolchain:brew-clang-macos-x86_64-toolchain ...
Expand Down Expand Up @@ -146,8 +148,11 @@ jobs:
- name: Upload binary to bootstrap.urbit.org
if: ${{ inputs.upload }}
run: |
version="$(cat ./pkg/vere/VERSION)"
target="gs://${UPLOAD_BASE}/${{ inputs.pace }}/v${version}/vere-v${version}-${{ matrix.target }}"
version="$(cat ./VERSION)"
bazel build :version
sha_version=$(grep 'URBIT_VERSION *".*"' ./bazel-bin/version.h \
| sed 's/^#define *URBIT_VERSION *"\([^"]*\)"/\1/')
target="gs://${UPLOAD_BASE}/${{ inputs.pace }}/v${sha_version}/vere-v${sha_version}-${{ matrix.target }}"
# See https://github.com/urbit/vere/issues/86.
if [[ "$version" == "1.16" ]]; then
Expand Down Expand Up @@ -223,14 +228,17 @@ jobs:
destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/urbit
provider: dockerhub
short_description: 'Urbit: a clean-slate OS and network for the 21st century'
readme_file: 'DOCKER.md'
readme_file: 'docker/README.md'

- name: Build and push Docker image
- name: Build and push version-tagged Docker image
if: ${{ inputs.docker && matrix.target == 'linux-x86_64' }}
run: |
version="v$(cat ./pkg/vere/VERSION)"
tag="$version-${{ inputs.pace }}"
bazel run :upload_docker
bazel run //docker:push_version_x86_64
- name: Build and push latest-tagged Docker image
if: ${{ inputs.docker && matrix.target == 'linux-x86_64' && inputs.pace == 'live' }}
run: |
bazel run //docker:push_latest_x86_64
upload-version-string:
name: Upload latest deployed version string to GCP
Expand All @@ -253,13 +261,14 @@ 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
bazel build :version_str
# We don't use -n here because we want to overwrite the version
# string.
gsutil cp ./pkg/vere/VERSION "$target"
gsutil cp ./bazel-bin/version "$target"
[ $exitcode -eq 0 ] &&
echo "Upload to $target completed successfully." ||
Expand Down
73 changes: 44 additions & 29 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
load("//bazel:common_settings.bzl", "string_flag")
load("@io_bazel_rules_docker//cc:image.bzl", "cc_image")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")

#
# OS-CPU CONFIG SETTINGS
Expand Down Expand Up @@ -126,41 +124,58 @@ platform(
],
)

alias(
name = "urbit",
actual = "//pkg/vere:urbit",
)

#
# DOCKER IMAGE
#

cc_image(
name = "docker",
binary = "//pkg/vere:urbit",
# Produce the `U3_VERE_PACE` macro.
genrule(
name = "pace_hdr",
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__"],
)

genrule(
name = "docker_tag",
visibility = ["//visibility:private"],
name = "version_str",
srcs = [
"//pkg/vere:PACE",
"//pkg/vere:VERSION",
# 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 = ["DOCKER_TAG"],
outs = ["version"],
cmd = """
pace=`tr -d '\n' < $(execpath //pkg/vere:PACE)`
version=v`tr -d '\n' < $(execpath //pkg/vere:VERSION)`
echo "$$version-$$pace" > $@
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 -n $$version > $@
""",
visibility = ["//:__subpackages__"],
)

# Produce the `URBIT_VERSION` macro.
genrule(
name = "version_hdr",
srcs = [":version_str"],
outs = ["version.h"],
cmd = """
echo '#ifndef URBIT_VERSION_H' > $@
echo '#define URBIT_VERSION_H' >> $@
printf '#define URBIT_VERSION "%s"\n' $$(cat $< | tr -d '\n') >> $@
echo '#endif' >> $@
""",
visibility = ["//:__subpackages__"],
)

container_push(
name = "upload_docker",
format = "Docker",
image = ":docker",
registry = "docker.io",
repository = "tloncorp/vere",
tag_file = ":docker_tag",
alias(
name = "urbit",
actual = "//pkg/vere:urbit",
)
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ completion.
### Branch Names

Every branch that you intend to put up for review must adhere to the form
`issue/N/<...>`, where `N` is the number of the issue that the branch corresponds
`i/<N>/<...>`, where `<N>` is the number of the issue that the branch corresponds
to and `<...>` is an optional short description of the branch to aid in
readability. If `<...>` is omitted, the `/` should be omitted as well, which
makes `issue/N` a well-formed branch name.
makes `i/<N>` a well-formed branch name.

### Commits

Expand All @@ -34,12 +34,12 @@ Optionally add a long description.

When your work is ready for review, open a pull request, making sure to link
to the tracking issue in the description, which should be formatted as follows
(where `N` is the number of this work's tracking issue):
(where `<N>` is the number of this work's tracking issue):

```
### Description
Resolves #N.
Resolves #<N>.
Thoroughly describe the changes made.
Expand Down
32 changes: 12 additions & 20 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ We use [`bazel`][bazel][^1] to build Vere, which is packaged as a single binary,
is where [`bazel`][bazel] runs and the target platform is where `urbit` will
run:

----------------------------------
Host Platform | Target Platform
----------------------------------
`linux-x86_64` | `linux-aarch64`
`linux-x86_64` | `linux-x86_64`
`macos-aarch64` | `macos-aarch64`
`macos-x86_64` | `macos-x86_64`
| Host Platform | Target Platform |
|----------------|-----------------|
| `linux-aarch64`| `linux-aarch64` |
| `linux-x86_64` | `linux-x86_64` |
| `macos-aarch64`| `macos-aarch64` |
| `macos-x86_64` | `macos-x86_64` |

## Prerequisites

Expand All @@ -25,7 +24,7 @@ $ brew install automake libtool

### Linux

We use [musl libc][musl libc] instead [glibc][glibc] on Linux, which enables us
We use [musl libc][musl libc] instead of [glibc][glibc] on Linux, which enables us
to generate statically linked binaries. As a prerequisite, you need to install
the [musl libc][musl libc] toolchain appropriate for your target platform.

Expand All @@ -51,17 +50,9 @@ This will take a few minutes.

## Build Commands

Once you install the prerequisites, you're ready to build. If you're performing
a native build (i.e. one in which the host platform and target platform are the
same), run:
Once you install the prerequisites, you're ready to build:
```console
$ bazel build //pkg/...
```

If you're performing a cross-platform build, you need to specify the target
platform in the build command:
```console
$ bazel build --platforms=//:<target-platform> //pkg/...
$ bazel build :urbit
```

The default optimization level is `-O3`, but if you want to specify a different
Expand All @@ -78,7 +69,7 @@ optimization levels.
You can build and run unit tests only on native builds. If you have a native
build and want to run all unit tests, run:
```console
$ bazel test //pkg/...
$ bazel test --build_tests_only ...
```

If you want to run a specific test, say
Expand Down Expand Up @@ -107,7 +98,8 @@ For more information on Bazel configuration files, consult the
If `bazel build` or `bazel test` generates an `undeclared inclusion(s) in rule`
error on macOS, the version of `clang` expected by the build system likely
doesn't match the version of `clang` installed on your system. To address this,
pass `--clang_version="<version_string>"` to the failing command.
run `clang --version` and pass the version number via
`--clang_version="<version_string>"` to the failing command.

[^1]: If you're interested in digging into the details of the build system,
check out [`WORKSPACE.bazel`](WORKSPACE.bazel),
Expand Down
Loading

0 comments on commit eda117a

Please sign in to comment.