From 256376afffe66faa239a6a6aaebb8f68a9c6cbe4 Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 14:35:41 +0700 Subject: very stuck --- vere/.github/CODEOWNERS | 6 + vere/.github/pull_request_template.md | 1 + vere/.github/workflows/develop.yml | 28 ++++ vere/.github/workflows/docker-once.yml | 11 ++ vere/.github/workflows/docker-shared.yml | 73 +++++++++++ vere/.github/workflows/feature.yml | 19 +++ vere/.github/workflows/master.yml | 29 ++++ vere/.github/workflows/next.yml | 22 ++++ vere/.github/workflows/once.yml | 12 ++ vere/.github/workflows/release.yml | 28 ++++ vere/.github/workflows/shared.yml | 219 +++++++++++++++++++++++++++++++ 11 files changed, 448 insertions(+) create mode 100644 vere/.github/CODEOWNERS create mode 100644 vere/.github/pull_request_template.md create mode 100644 vere/.github/workflows/develop.yml create mode 100644 vere/.github/workflows/docker-once.yml create mode 100644 vere/.github/workflows/docker-shared.yml create mode 100644 vere/.github/workflows/feature.yml create mode 100644 vere/.github/workflows/master.yml create mode 100644 vere/.github/workflows/next.yml create mode 100644 vere/.github/workflows/once.yml create mode 100644 vere/.github/workflows/release.yml create mode 100644 vere/.github/workflows/shared.yml (limited to 'vere/.github') diff --git a/vere/.github/CODEOWNERS b/vere/.github/CODEOWNERS new file mode 100644 index 0000000..147aa59 --- /dev/null +++ b/vere/.github/CODEOWNERS @@ -0,0 +1,6 @@ +# For more information on how CODEOWNERS work, see +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners. + +# Default owner for everything in the repo. Matches farther down in the file +# will override this default. +* @urbit/runtime diff --git a/vere/.github/pull_request_template.md b/vere/.github/pull_request_template.md new file mode 100644 index 0000000..01e58ed --- /dev/null +++ b/vere/.github/pull_request_template.md @@ -0,0 +1 @@ +Resolves # diff --git a/vere/.github/workflows/develop.yml b/vere/.github/workflows/develop.yml new file mode 100644 index 0000000..36aedc0 --- /dev/null +++ b/vere/.github/workflows/develop.yml @@ -0,0 +1,28 @@ +name: Push to develop + +on: + push: + branches: + - develop + paths: + - 'build.zig' + - 'build.zig.zon' + - 'ext/**' + - '!ext/**.md' + - 'pkg/**' + - '.github/workflows/**.yml' + - '*.sh' + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + pace: 'edge' + upload: true + secrets: inherit + + docker: + uses: ./.github/workflows/docker-shared.yml + with: + pace: 'edge' + secrets: inherit diff --git a/vere/.github/workflows/docker-once.yml b/vere/.github/workflows/docker-once.yml new file mode 100644 index 0000000..2f17659 --- /dev/null +++ b/vere/.github/workflows/docker-once.yml @@ -0,0 +1,11 @@ +name: Deploy to DockerHub once + +on: + workflow_dispatch + +jobs: + docker: + uses: ./.github/workflows/docker-shared.yml + with: + pace: 'edge' + secrets: inherit diff --git a/vere/.github/workflows/docker-shared.yml b/vere/.github/workflows/docker-shared.yml new file mode 100644 index 0000000..a2a0eb7 --- /dev/null +++ b/vere/.github/workflows/docker-shared.yml @@ -0,0 +1,73 @@ +name: docker + +on: + workflow_call: + inputs: + pace: + description: 'Release pace' + type: string + default: 'edge' + required: false + +jobs: + urbit: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - uses: mlugg/setup-zig@v1 + with: + version: 0.14.0 + + # + # BUILD + # + + - name: Build binary + id: build + run: | + zig build \ + -Dtarget=x86_64-linux-musl \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + --summary all + + cp zig-out/x86_64-linux-musl/urbit docker/. + + echo version=v$(sed -nr 's/#define URBIT_VERSION "(.*)"/\1/p' zig-out/include/version.h) >> $GITHUB_OUTPUT + + # + # UPLOAD TO DOCKER + # + + - uses: docker/docker-login-action@v1.8.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: christian-korneck/update-container-description-action@v1 + env: + DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} + with: + destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/vere + provider: dockerhub + short_description: 'Urbit: a clean-slate OS and network for the 21st century' + readme_file: 'docker/README.md' + + - name: Build and push + if: ${{ inputs.pace != 'live' }} + uses: docker/build-push-action@v6 + with: + push: true + context: docker + tags: tloncorp/vere:${{ steps.build.outputs.version }},tloncorp/vere:${{ inputs.pace }} + + - name: Build and push live + if: ${{ inputs.pace == 'live' }} + uses: docker/build-push-action@v6 + with: + push: true + context: docker + tags: tloncorp/vere:latest diff --git a/vere/.github/workflows/feature.yml b/vere/.github/workflows/feature.yml new file mode 100644 index 0000000..d78b911 --- /dev/null +++ b/vere/.github/workflows/feature.yml @@ -0,0 +1,19 @@ +name: Feature pull request + +on: + pull_request: + paths: + - 'build.zig' + - 'build.zig.zon' + - 'ext/**' + - '!ext/**.md' + - 'pkg/**' + - '.github/workflows/**.yml' + - '*.sh' + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + pace: 'edge' + upload: false diff --git a/vere/.github/workflows/master.yml b/vere/.github/workflows/master.yml new file mode 100644 index 0000000..02a2b84 --- /dev/null +++ b/vere/.github/workflows/master.yml @@ -0,0 +1,29 @@ +name: Push to master + +on: + push: + branches: + - master + paths: + - 'build.zig' + - 'build.zig.zon' + - 'ext/**' + - '!ext/**.md' + - 'pkg/**' + - '.github/workflows/**.yml' + - '*.sh' + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + pace: 'live' + upload: true + fake_tests: false + secrets: inherit + + docker: + uses: ./.github/workflows/docker-shared.yml + with: + pace: 'live' + secrets: inherit diff --git a/vere/.github/workflows/next.yml b/vere/.github/workflows/next.yml new file mode 100644 index 0000000..71738ad --- /dev/null +++ b/vere/.github/workflows/next.yml @@ -0,0 +1,22 @@ +name: Push to next/kelvin/* + +on: + push: + branches: + - 'next/kelvin/*' + paths: + - 'build.zig' + - 'build.zig.zon' + - 'ext/**' + - '!ext/**.md' + - 'pkg/**' + - '.github/workflows/**.yml' + - '*.sh' + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + upload: true + next: ${{ github.ref_name }} + secrets: inherit diff --git a/vere/.github/workflows/once.yml b/vere/.github/workflows/once.yml new file mode 100644 index 0000000..1081180 --- /dev/null +++ b/vere/.github/workflows/once.yml @@ -0,0 +1,12 @@ +name: Deploy once + +on: + workflow_dispatch + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + pace: 'once' + upload: true + secrets: inherit diff --git a/vere/.github/workflows/release.yml b/vere/.github/workflows/release.yml new file mode 100644 index 0000000..ca4a907 --- /dev/null +++ b/vere/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Push to release + +on: + push: + branches: + - release + paths: + - 'build.zig' + - 'build.zig.zon' + - 'ext/**' + - '!ext/**.md' + - 'pkg/**' + - '.github/workflows/**.yml' + - '*.sh' + +jobs: + urbit: + uses: ./.github/workflows/shared.yml + with: + pace: 'soon' + upload: true + secrets: inherit + + docker: + uses: ./.github/workflows/docker-shared.yml + with: + pace: 'soon' + secrets: inherit diff --git a/vere/.github/workflows/shared.yml b/vere/.github/workflows/shared.yml new file mode 100644 index 0000000..e13506e --- /dev/null +++ b/vere/.github/workflows/shared.yml @@ -0,0 +1,219 @@ +name: shared + +on: + workflow_call: + inputs: + pace: + description: 'Release pace' + type: string + default: 'edge' + required: false + upload: + description: 'Upload binaries to GCP' + type: boolean + default: false + required: false + fake_tests: + description: 'Run fake ship tests' + type: boolean + default: true + required: false + next: + description: 'Next Kelvin version branch name' + type: string + default: null + required: false + secrets: + GCP_CREDENTIALS: + required: false + GCP_PROJECT: + required: false + +env: + UPLOAD_BASE: bootstrap.urbit.org/vere + GH_TOKEN: ${{ github.token }} + +jobs: + urbit: + strategy: + fail-fast: false + + runs-on: ubuntu-22.04 + + steps: + # + # BUILD AND TEST + # + - uses: actions/checkout@v3 + + - name: Set swap space + run: | + echo "Memory and swap:" + free -h + echo + swapon --show + echo + + export SWAP_FILE=$(swapon --show=NAME | tail -n 1) + if test -z "${SWAP_FILE}"; then + export SWAP_FILE=/swapfile + else + sudo swapoff -a + sudo rm "${SWAP_FILE}" + fi + sudo fallocate -l 10G "${SWAP_FILE}" + sudo chmod 600 "${SWAP_FILE}" + sudo mkswap "${SWAP_FILE}" + sudo swapon "${SWAP_FILE}" + + echo "Memory and swap:" + free -h + echo + swapon --show + echo + + - uses: mlugg/setup-zig@v2 + with: + version: 0.14.1 + + - name: Build binaries + run: | + if [[ "${{ inputs.pace }}" == "live" ]]; then + zig build \ + -Dall \ + -Drelease \ + --summary all + else + zig build \ + -Dall \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + --summary all + fi + - name: Run unit tests + run: | + zig build \ + ur-test ent-test \ + hashtable-test jets-test \ + nock-test retrieve-test \ + serial-test ames-test \ + pact-test equality-test \ + boot-test newt-test \ + vere-noun-test unix-test \ + benchmarks \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + --summary all + + - name: Build test binary + if: ${{ inputs.fake_tests }} + run: | + zig build \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + -Dbinary-name=urbit-test \ + -Dcpu-dbg \ + -Dmem-dbg \ + -Dc3dbg \ + -Dsnapshot-validation \ + --summary all + + - name: Boot fake ship + if: ${{ inputs.fake_tests }} + env: + URBIT_BINARY: "zig-out/x86_64-linux-musl/urbit-test" + run: ./boot-fake-ship.sh + + - name: Run fake ship tests + if: ${{ inputs.fake_tests }} + env: + URBIT_BINARY: "zig-out/x86_64-linux-musl/urbit-test" + run: ./test-fake-ship.sh + + # + # UPLOAD TO GCP + # + + - uses: google-github-actions/auth@v1 + if: ${{ inputs.upload }} + with: + credentials_json: ${{ secrets.GCP_CREDENTIALS }} + + - uses: google-github-actions/setup-gcloud@v1 + if: ${{ inputs.upload }} + with: + project_id: ${{ secrets.GCP_PROJECT }} + + - name: Upload binary to bootstrap.urbit.org + if: ${{ inputs.upload }} + run: | + sha_version=$(sed -nr 's/#define URBIT_VERSION "(.*)"/\1/p' zig-out/include/version.h) + declare -a targets=( + "aarch64-linux-musl linux-aarch64" + "aarch64-macos-none macos-aarch64" + "x86_64-linux-musl linux-x86_64" + "x86_64-macos-none macos-x86_64" + ) + for t in "${targets[@]}" + do + IFS=' ' read zig_target target <<< "${t}" + urbit_static=$GITHUB_WORKSPACE/zig-out/${zig_target}/urbit + if ${{ inputs.next != null }}; then + next=$(echo "${{ inputs.next }}" | sed 's/[^0-9]//g') + dest="gs://${UPLOAD_BASE}/next/kelvin/${next}/v${sha_version}/vere-v${sha_version}-${target}" + else + dest="gs://${UPLOAD_BASE}/${{ inputs.pace }}/v${sha_version}/vere-v${sha_version}-${target}" + fi + + args="" + # We never overwrite a binary deployed to the "live" train, but we do + # overwrite same-versioned binaries deployed to the "soon" and "edge" + # trains. + if [[ "${{ inputs.pace }}" == "live" ]]; then + gsutil cp -n "${urbit_static}" "$dest" + else + gsutil cp "${urbit_static}" "$dest" + fi + exitcode=$? + + ([ $exitcode -eq 0 ] && echo "upload to $dest complete.") || + (echo "upload to $dest failed." && exit $exitcode); + done + + upload-version-string: + name: Upload latest deployed version string to GCP + runs-on: ubuntu-latest + needs: [urbit] + if: inputs.upload + steps: + - uses: actions/checkout@v3 + + - uses: google-github-actions/auth@v1 + with: + credentials_json: ${{ secrets.GCP_CREDENTIALS }} + + - uses: google-github-actions/setup-gcloud@v1 + with: + project_id: ${{ secrets.GCP_PROJECT }} + + - name: Upload latest deployed version string to GCP + run: | + echo "${{ inputs.pace }}" > ./PACE + printf $(sed -nr 's/const VERSION = "(.*)"\;/\1/p' build.zig)-%.10s $(git rev-parse HEAD) > ./VERSION + + if ${{ inputs.next != null }}; then + next=$(echo "${{ inputs.next }}" | sed 's/[^0-9]//g') + target="gs://${UPLOAD_BASE}/next/kelvin/${next}/last" + else + target="gs://${UPLOAD_BASE}/${{ inputs.pace }}/last" + fi + + # We don't use -n here because we want to overwrite the version + # string. + gsutil cp ./VERSION "$target" + exitcode=$? + + [ $exitcode -eq 0 ] && + echo "Upload to $target completed successfully." || + echo "Upload to $target failed."; + exit $exitcode -- cgit v1.2.3