2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
name: vere
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
upload:
|
|
|
|
description: 'upload binaries to gcp'
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
required: false
|
|
|
|
pace:
|
|
|
|
description: 'release pace'
|
|
|
|
type: string
|
2022-11-11 19:47:07 +03:00
|
|
|
default: 'edge'
|
2022-05-27 20:12:00 +03:00
|
|
|
required: false
|
|
|
|
secrets:
|
|
|
|
CACHIX_AUTH_TOKEN:
|
2022-06-03 09:13:40 +03:00
|
|
|
required: false
|
2022-11-11 19:24:15 +03:00
|
|
|
GCP_CREDENTIALS:
|
|
|
|
required: false
|
2022-05-27 20:12:00 +03:00
|
|
|
GCS_SERVICE_ACCOUNT_KEY:
|
2022-06-03 09:13:40 +03:00
|
|
|
required: false
|
2022-05-27 20:12:00 +03:00
|
|
|
GCS_PROJECT:
|
2022-06-03 09:13:40 +03:00
|
|
|
required: false
|
2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
upload:
|
|
|
|
description: 'upload binaries to gcp'
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
required: false
|
|
|
|
pace:
|
|
|
|
description: 'release pace'
|
|
|
|
type: choice
|
|
|
|
options:
|
2022-11-11 19:47:07 +03:00
|
|
|
- edge
|
2022-05-27 20:12:00 +03:00
|
|
|
- soon
|
2022-06-01 10:23:53 +03:00
|
|
|
- live
|
2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
UPLOAD_BASE: bootstrap.urbit.org/vere
|
|
|
|
VERE_PACE: ${{ inputs.pace }}
|
2022-06-01 10:23:53 +03:00
|
|
|
VERSION_TYPE: ${{ (inputs.pace == 'soon' || inputs.pace == 'live') && 'real' || 'hash' }}
|
2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
urbit:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2022-11-11 06:44:05 +03:00
|
|
|
- { os: ubuntu-latest, type: linux }
|
|
|
|
- { os: macos-latest, type: macos }
|
|
|
|
- { os: buildjet-4vcpu-ubuntu-2204-arm, type: linux }
|
2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# We only want the extra nix config on linux, where it is necessary
|
|
|
|
# for the docker build. We don't want in on Mac, where it isn't but
|
|
|
|
# it breaks the nix install. The two `if` clauses should be mutually
|
|
|
|
# exclusive
|
|
|
|
- uses: cachix/install-nix-action@v16
|
|
|
|
with:
|
|
|
|
extra_nix_config: |
|
|
|
|
system-features = nixos-test benchmark big-parallel kvm
|
2022-11-11 06:44:05 +03:00
|
|
|
if: ${{ matrix.type == 'linux' }}
|
2022-05-27 20:12:00 +03:00
|
|
|
- uses: cachix/install-nix-action@v16
|
|
|
|
if: ${{ matrix.os != 'ubuntu-latest' }}
|
|
|
|
|
|
|
|
- uses: cachix/cachix-action@v10
|
|
|
|
with:
|
|
|
|
name: ares
|
|
|
|
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
|
|
|
|
2022-11-11 18:29:29 +03:00
|
|
|
# run unit tests early on linux (x-compilation will skip them)
|
|
|
|
- name: build dynamic binary (and run tests)
|
|
|
|
if: ${{ matrix.type == 'linux' }}
|
|
|
|
run: nix-build -A urbit
|
|
|
|
|
2022-05-27 20:12:00 +03:00
|
|
|
- name: build static binary
|
|
|
|
run: |
|
|
|
|
nix-build -A urbit \
|
|
|
|
--arg enableStatic true \
|
|
|
|
--argstr verePace ${{ env.VERE_PACE }} > ./urbit-derivation
|
|
|
|
cat ./urbit-derivation
|
|
|
|
echo -n "urbit_static=" >> $GITHUB_ENV
|
|
|
|
cat ./urbit-derivation >> $GITHUB_ENV
|
|
|
|
cat ./urbit-derivation
|
|
|
|
|
|
|
|
- name: confirm binary is mostly static
|
2022-11-11 06:44:05 +03:00
|
|
|
if: matrix.type == 'macos'
|
2022-05-27 20:12:00 +03:00
|
|
|
run: |
|
|
|
|
bin="${{ env.urbit_static }}/bin/urbit"
|
|
|
|
|
|
|
|
if [ ! -f "$bin" ]; then
|
|
|
|
echo "no binary at $bin"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
libs="$(otool -L "${{ env.urbit_static }}/bin/urbit" | tail -n +2)"
|
|
|
|
|
|
|
|
# XX CoreFoundation?
|
|
|
|
if [ -z "$(echo "$libs" | grep -v libSystem)" ]; then
|
|
|
|
echo "it's mostly static"
|
|
|
|
echo "$libs"
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "dynamic links found:"
|
|
|
|
echo "$libs"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: get version string
|
|
|
|
run: |
|
|
|
|
if [ "real" == "$VERSION_TYPE" ]; then
|
|
|
|
version="$(cat ./pkg/urbit/version)"
|
|
|
|
else
|
|
|
|
version="${GITHUB_SHA:0:9}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n "$version" > ./version-string
|
|
|
|
|
|
|
|
- name: upload version string artifact
|
2023-01-03 21:24:54 +03:00
|
|
|
if: matrix.type == 'linux'
|
2022-05-27 20:12:00 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version-string
|
|
|
|
path: version-string
|
|
|
|
|
2022-11-11 19:24:15 +03:00
|
|
|
- uses: google-github-actions/auth@v1
|
|
|
|
with:
|
|
|
|
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
|
|
|
|
|
|
|
|
- uses: google-github-actions/setup-gcloud@v1
|
2022-05-27 20:12:00 +03:00
|
|
|
if: inputs.upload
|
|
|
|
with:
|
|
|
|
project_id: ${{ secrets.GCS_PROJECT }}
|
|
|
|
|
|
|
|
- name: upload binary to bootstrap.urbit.org
|
|
|
|
if: inputs.upload
|
|
|
|
run: |
|
|
|
|
version="$(cat ./version-string)"
|
|
|
|
system="$(nix-instantiate --eval --expr 'builtins.currentSystem')"
|
|
|
|
system=${system:1:${#system}-2}
|
|
|
|
target="gs://${UPLOAD_BASE}/${VERE_PACE}/${version}/vere-v${version}-${system}"
|
|
|
|
|
|
|
|
gsutil cp -n "${{ env.urbit_static }}/bin/urbit" "$target"
|
|
|
|
exitcode=$?
|
|
|
|
|
|
|
|
test $exitcode -eq 0 &&
|
|
|
|
echo "upload to $target complete." ||
|
|
|
|
echo "upload to $target failed.";
|
|
|
|
exit $exitcode
|
|
|
|
|
|
|
|
- if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
|
|
run: nix-build -A urbit-tests
|
|
|
|
|
|
|
|
- if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
|
|
run: nix-build -A docker-image
|
|
|
|
|
|
|
|
after:
|
|
|
|
runs-on: ubuntu-latest
|
2023-01-05 20:53:44 +03:00
|
|
|
needs: [urbit]
|
2022-07-15 17:48:04 +03:00
|
|
|
if: inputs.upload
|
2022-05-27 20:12:00 +03:00
|
|
|
steps:
|
2023-01-03 21:24:54 +03:00
|
|
|
- uses: google-github-actions/setup-gcloud@v0.2.0
|
2022-05-27 20:12:00 +03:00
|
|
|
with:
|
2023-01-03 21:24:54 +03:00
|
|
|
version: '290.0.1'
|
|
|
|
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
|
2022-05-27 20:12:00 +03:00
|
|
|
project_id: ${{ secrets.GCS_PROJECT }}
|
2023-01-03 21:24:54 +03:00
|
|
|
export_default_credentials: true
|
2022-05-27 20:12:00 +03:00
|
|
|
|
|
|
|
- name: download version-string
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version-string
|
|
|
|
|
|
|
|
- name: update latest deployed version
|
|
|
|
run: |
|
|
|
|
target="gs://${UPLOAD_BASE}/${VERE_PACE}/last"
|
|
|
|
|
|
|
|
# *not* -n, as we want to overwrite the latest version-string
|
|
|
|
#
|
|
|
|
gsutil cp ./version-string "$target"
|
|
|
|
exitcode=$?
|
|
|
|
|
|
|
|
test $exitcode -eq 0 &&
|
|
|
|
echo "upload to $target complete." ||
|
|
|
|
echo "upload to $target failed.";
|
|
|
|
exit $exitcode
|