diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7b704a01..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,63 +0,0 @@ -version: '2.1' -orbs: - gh: circleci/github-cli@2.2.0 - -jobs: - build: - docker: - - image: cimg/go:1.21.1 - steps: - - checkout - - run: - name: Build for multiple platforms - command: | - goos=("darwin" "darwin" "linux" "linux") - goarch=("arm64" "amd64" "arm64" "amd64") - for os in "${goos[@]}"; do - for arch in "${goarch[@]}"; do - output_dir="build/${os}-${arch}" - output_name="lilypad-${os}-${arch}" - mkdir -p "${output_dir}" - GOOS=${os} GOARCH=${arch} go build -o "${output_dir}/${output_name}" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=$(git describe --tags --abbrev=0)' \ - -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=$(git rev-parse HEAD)'" - done - done - - persist_to_workspace: - root: build/ - paths: - - "*" - - store_artifacts: - path: build/ - destination: build_artifacts - - release: - docker: - - image: cimg/go:1.21.1 - steps: - - attach_workspace: - at: /tmp/build - - checkout - - run: - name: GitHub release - command: | - SHA=$(git rev-parse HEAD) - SHORTSHA="${SHA:0:7}" - wget https://github.com/cli/cli/releases/download/v2.35.0/gh_2.35.0_linux_amd64.deb - sudo dpkg -i gh_2.35.0_linux_amd64.deb - gh release create v2.0.0-${SHORTSHA} --notes "Release v2.0.0-${SHORTSHA}" \ - /tmp/build/darwin-arm64/lilypad-darwin-arm64 \ - /tmp/build/darwin-amd64/lilypad-darwin-amd64 \ - /tmp/build/linux-arm64/lilypad-linux-arm64 \ - /tmp/build/linux-amd64/lilypad-linux-amd64 - -workflows: - test-and-deploy: - jobs: - - build - - release: - filters: - branches: - only: main - requires: - - build - diff --git a/.github/releases/README.md b/.github/releases/README.md new file mode 100644 index 00000000..ea83f31b --- /dev/null +++ b/.github/releases/README.md @@ -0,0 +1,3 @@ +# Releases + +The `release_notes.md` contents are appended to the auto-generated `release-please` release notes. We can use this to customize release notes, but keep in mind that changes will propagate to future releases. diff --git a/.github/releases/release_notes.md b/.github/releases/release_notes.md new file mode 100644 index 00000000..0dfc1c9d --- /dev/null +++ b/.github/releases/release_notes.md @@ -0,0 +1,3 @@ +### Notes + +Resource providers should download the `gpu` binary assets. The `cpu` binaries are for CLI users creating jobs on machines without a GPU. diff --git a/.github/workflows/darwin_amd64.yml b/.github/workflows/darwin_amd64.yml deleted file mode 100644 index b6b195bf..00000000 --- a/.github/workflows/darwin_amd64.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build darwin-amd64 binary (no gpu) - -on: - push: - branches: - - main - -jobs: - build: - runs-on: macos-13 #uses amd64 - - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.22' - - - name: Check architecture - run: uname -m - - - name: Build for darwin/amd64 - env: - GOOS: darwin - GOARCH: amd64 - CGO_ENABLED: 1 - run: | - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" - output_dir="build/${GOOS}-${GOARCH}" - output_name="lilypad-${GOOS}-${GOARCH}" - mkdir -p "${output_dir}" - - # Debug: Print environment variables for the build - echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" - - echo "excluding CUDA. specify 'cuda' build tag to include it." - - go build -o "${output_dir}/${output_name}" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=$(git describe --tags --abbrev=0)' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=$(git rev-parse HEAD)'" - - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" - - - name: Upload binary - uses: actions/upload-artifact@v3 - with: - name: darwin-amd64-binary - path: build/darwin-amd64/lilypad-darwin-amd64 - - - name: Verify Build Output - run: | - ls -la build/darwin-amd64 - echo "Build complete" diff --git a/.github/workflows/darwin_arm64.yml b/.github/workflows/darwin_arm64.yml deleted file mode 100644 index c8b9990f..00000000 --- a/.github/workflows/darwin_arm64.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build darwin-arm64 binary (no gpu) - -on: - push: - branches: - - main - -jobs: - build: - runs-on: macos-latest #uses M1 - - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.22' - - - name: Check architecture - run: uname -m - - - name: Build for darwin/arm64 - env: - GOOS: darwin - GOARCH: arm64 - CGO_ENABLED: 1 - run: | - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" - output_dir="build/${GOOS}-${GOARCH}" - output_name="lilypad-${GOOS}-${GOARCH}" - mkdir -p "${output_dir}" - - # Debug: Print environment variables for the build - echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" - - echo "excluding CUDA. specify 'cuda' build tag to include it." - - go build -o "${output_dir}/${output_name}" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=$(git describe --tags --abbrev=0)' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=$(git rev-parse HEAD)'" - - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" - - - name: Upload binary - uses: actions/upload-artifact@v3 - with: - name: darwin-arm64-binary - path: build/darwin-arm64/lilypad-darwin-arm64 - - - name: Verify Build Output - run: | - ls -la build/darwin-arm64 - echo "Build complete" diff --git a/.github/workflows/linux_amd64.yml b/.github/workflows/linux_amd64.yml deleted file mode 100644 index 398e7d32..00000000 --- a/.github/workflows/linux_amd64.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build linux-amd64 binary (GPU) - -on: - push: - branches: - - main - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.22' - - - name: Add NVIDIA package repository - run: | - sudo apt-get install -y gnupg2 curl - sudo mkdir -p /usr/share/keyrings - curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-drivers.gpg - echo "deb [signed-by=/usr/share/keyrings/nvidia-drivers.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/ /" | sudo tee /etc/apt/sources.list.d/nvidia-drivers.list - - - name: Update package lists - run: sudo apt-get update || true # Ignore errors from this command - - - name: Install NVIDIA CUDA Toolkit - run: | - sudo apt-get install -y nvidia-cuda-toolkit - export PATH=/usr/local/cuda/bin:$PATH - - - name: Build for linux/amd64 - env: - GOOS: linux - GOARCH: amd64 - CGO_ENABLED: 1 - CUDA_HOME: /usr/local/cuda - LD_LIBRARY_PATH: /usr/local/cuda/lib64:$LD_LIBRARY_PATH - run: | - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" - output_dir="build/${GOOS}-${GOARCH}" - output_name="lilypad-${GOOS}-${GOARCH}" - mkdir -p "${output_dir}" - - # Debug: Print environment variables for the build - echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" - echo "CUDA_HOME: $CUDA_HOME" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - - go build -o "${output_dir}/${output_name}" -v -tags cuda -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=$(git describe --tags --abbrev=0)' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=$(git rev-parse HEAD)'" - - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" - - - name: Upload binary - uses: actions/upload-artifact@v3 - with: - name: linux-amd64-binary - path: build/linux-amd64/lilypad-linux-amd64 - - - name: Verify Build Output - run: | - ls -la build/linux-amd64 - echo "Build complete" diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml deleted file mode 100644 index 0d1a9b13..00000000 --- a/.github/workflows/linux_arm64.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build linux-arm64 binary (GPU) - -on: - push: - branches: - - main - -jobs: - - build: - runs-on: linux-arm64 - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.22' - - - name: Add NVIDIA package repository - run: | - sudo apt-get install -y gnupg2 curl - sudo mkdir -p /usr/share/keyrings - curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-drivers.gpg - echo "deb [signed-by=/usr/share/keyrings/nvidia-drivers.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/ /" | sudo tee /etc/apt/sources.list.d/nvidia-drivers.list - - - name: Update package lists - run: sudo apt-get update || true # Ignore errors from this command - - - name: Install NVIDIA CUDA Toolkit - run: | - sudo apt-get install -y nvidia-cuda-toolkit - export PATH=/usr/local/cuda/bin:$PATH - - - name: Build for linux/arm64 - env: - GOOS: linux - GOARCH: arm64 - CGO_ENABLED: 1 - CUDA_HOME: /usr/local/cuda - LD_LIBRARY_PATH: /usr/local/cuda/lib64:$LD_LIBRARY_PATH - run: | - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" - output_dir="build/${GOOS}-${GOARCH}" - output_name="lilypad-${GOOS}-${GOARCH}" - mkdir -p "${output_dir}" - - # Debug: Print environment variables for the build - echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" - echo "CUDA_HOME: $CUDA_HOME" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - - go build -o "${output_dir}/${output_name}" -v -tags cuda -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=$(git describe --tags --abbrev=0)' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=$(git rev-parse HEAD)'" - - echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" - - - name: Upload binary - uses: actions/upload-artifact@v3 - with: - name: linux-arm64-binary - path: build/linux-arm64/lilypad-linux-arm64 - - - name: Verify Build Output - run: | - ls -la build/linux-arm64 - echo "Build complete" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..25fa122b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,214 @@ +name: Release + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Create Release PR or Release + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: Get Release Bot Token + id: get-release-bot-token + uses: peter-murray/workflow-application-token-action@v1 + with: + application_id: ${{ secrets.RELEASE_BOT_ID }} + application_private_key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + organization: "Lilypad-Tech" + + # Create release PR or release + # - PRs are created on user-facing changes (feat, fix, or any breaking changes). + # We merge these immediately in the merge job which pushes a release commit. + # - Releases are created when release-please finds an unpublished release commit + # from one of its PRs. + - name: Create Release PR or Release + id: release + uses: googleapis/release-please-action@v4 + with: + token: ${{ steps.get-release-bot-token.outputs.token }} + + outputs: + prs_created: ${{ steps.release.outputs.prs_created }} + releases_created: ${{ steps.release.outputs.releases_created }} + sha: ${{ steps.release.outputs.sha }} + tag_name: ${{ steps.release.outputs.tag_name }} + + merge: + if: needs.release.outputs.prs_created == 'true' && needs.release.outputs.releases_created == 'false' + name: Merge Release PR + needs: release + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: release-please--branches--main + + - name: Get Release Bot Token + id: get-release-bot-token + uses: peter-murray/workflow-application-token-action@v1 + with: + application_id: ${{ secrets.RELEASE_BOT_ID }} + application_private_key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + organization: "Lilypad-Tech" + + # Approve with github-actions bot + - name: Approve PR + id: approve + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr review --approve + + # Auto-merge PR when status checks complete or merge immediately if no checks in progress + # The auto-merge flag requires branch protection rule overrides. + - name: Merge Release PR + env: + GH_TOKEN: ${{ steps.get-release-bot-token.outputs.token }} + run: gh pr merge --squash --auto || gh pr merge --squash + + extend-notes: + if: needs.release.outputs.releases_created == 'true' && needs.release.outputs.prs_created == 'false' + name: Extend Release Notes + needs: release + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.release.outputs.tag_name }} + + - name: Get Release Bot Token + id: get-release-bot-token + uses: peter-murray/workflow-application-token-action@v1 + with: + application_id: ${{ secrets.RELEASE_BOT_ID }} + application_private_key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + organization: "Lilypad-Tech" + + - name: Extend Release Notes + env: + GH_TOKEN: ${{ steps.get-release-bot-token.outputs.token }} + run: | + BODY=$(gh release view ${{ needs.release.outputs.tag_name }} --json body | jq -r '.body') + EXTENSION=$(cat .github/releases/release_notes.md) + + # Build up notes from BODY and EXTENSION seperated by two newlines + # https://trstringer.com/github-actions-multiline-strings/#option-2---environment-variable + NOTES=$(cat << EOF + $BODY + + $EXTENSION + EOF + ) + echo "NOTES<> $GITHUB_ENV + echo "$NOTES" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + gh release edit ${{ needs.release.outputs.tag_name }} --notes "$NOTES" + + publish-binaries: + if: needs.release.outputs.releases_created == 'true' && needs.release.outputs.prs_created == 'false' + name: Build and Publish Binaries + needs: release + strategy: + matrix: + include: + - goos: linux + goarch: amd64 + gpu: true + runner: ubuntu-latest + - goos: linux + goarch: arm64 + gpu: true + runner: linux-arm64 + - goos: darwin + goarch: amd64 + gpu: false + runner: macos-13 # uses amd64 + - goos: darwin + goarch: arm64 + gpu: false + runner: macos-latest # uses M1 + runs-on: ${{ matrix.runner }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.release.outputs.tag_name }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.22" + + - name: Build for ${{ matrix.goos }}/${{ matrix.goarch }} CPU-only + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 1 + GH_TOKEN: ${{ github.token }} + run: | + echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" + mkdir -p build + + # Debug: Print environment variables for the build + echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" + echo "Excluding CUDA. Use the 'cuda' build tag to include it." + + go build -o "build/lilypad-${GOOS}-${GOARCH}-cpu" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.version=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.commitSHA=${{ needs.release.outputs.sha }}'" + + echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" + + # Upload binary to release + gh release upload ${{ needs.release.outputs.tag_name }} "build/lilypad-${GOOS}-${GOARCH}-cpu" + + - name: Install NVIDIA CUDA Toolkit + if: ${{ matrix.gpu }} + run: | + sudo apt-get install -y gnupg2 curl + sudo mkdir -p /usr/share/keyrings + curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-drivers.gpg + echo "deb [signed-by=/usr/share/keyrings/nvidia-drivers.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/ /" | sudo tee /etc/apt/sources.list.d/nvidia-drivers.list + sudo apt-get update || true # Ignore errors from this command + sudo apt-get install -y nvidia-cuda-toolkit + export PATH=/usr/local/cuda/bin:$PATH + + - name: Build for ${{ matrix.goos }}/${{ matrix.goarch }} GPU + if: ${{ matrix.gpu }} + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 1 + CUDA_HOME: /usr/local/cuda + LD_LIBRARY_PATH: /usr/local/cuda/lib64:$LD_LIBRARY_PATH + GH_TOKEN: ${{ github.token }} + run: | + echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- start" + mkdir -p build + + # Debug: Print environment variables for the build + echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH" + echo "CUDA_HOME: $CUDA_HOME" + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" + + go build -o "build/lilypad-${GOOS}-${GOARCH}-gpu" -v -tags cuda -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.version=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.commitSHA=${{ needs.release.outputs.sha }}'" + + echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done" + + # Upload binary to release + gh release upload ${{ needs.release.outputs.tag_name }} "build/lilypad-${GOOS}-${GOARCH}-gpu" diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml deleted file mode 100644 index e8bd83f9..00000000 --- a/.github/workflows/release_binaries.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Release binaries - -on: - workflow_run: - workflows: - - linux_amd64.yml - - linux_arm64.yml - - darwin_amd64.yml - - darwin_arm64.yml - types: - - completed - -jobs: - release: - if: ${{ github.event.workflow_run.head_branch == 'main' }} # Only run this job on the main branch - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git fetch --tags - SHORTSHA=$(git rev-parse --short HEAD) - echo "SHORTSHA=${SHORTSHA}" >> $GITHUB_ENV - - - name: Download linux-amd64 binary - uses: actions/download-artifact@v3 - with: - name: linux-amd64-binary - path: /tmp/build/lilypad-linux-amd64 - - - name: Download linux-arm64 binary - uses: actions/download-artifact@v3 - with: - name: linux-arm64-binary - path: /tmp/build/lilypad-linux-arm64 - - - name: Download darwin-amd64 binary - uses: actions/download-artifact@v3 - with: - name: darwin-amd64-binary - path: /tmp/build/lilypad-darwin-amd64 - - - name: Download darwin-arm64 binary - uses: actions/download-artifact@v3 - with: - name: darwin-arm64-binary - path: /tmp/build/lilypad-darwin-arm64 - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v2.0.0-${{ env.SHORTSHA }} - release_name: "Release v2.0.0-${{ env.SHORTSHA }}" - body: "Release v2.0.0-${{ env.SHORTSHA }}" - draft: false - prerelease: false - - - - name: Upload Release Asset - linux-amd64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/build/lilypad-linux-amd64 - asset_name: lilypad-linux-amd64 - asset_content_type: application/octet-stream - - - name: Upload Release Asset - linux-arm64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/build/lilypad-linux-arm64 - asset_name: lilypad-linux-arm64 - asset_content_type: application/octet-stream - - - name: Upload Release Asset - darwin-arm64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/build/lilypad-darwin-arm64 - asset_name: lilypad-darwin-arm64 - asset_content_type: application/octet-stream - - - name: Upload Release Asset - darwin-amd64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/build/lilypad-darwin-amd64 - asset_name: lilypad-darwin-amd64 - asset_content_type: application/octet-stream diff --git a/.github/workflows/testnet_deploy_services.yml b/.github/workflows/testnet_deploy_services.yml index 9242b0e8..abc16ea8 100644 --- a/.github/workflows/testnet_deploy_services.yml +++ b/.github/workflows/testnet_deploy_services.yml @@ -2,8 +2,8 @@ name: Deploy Testnet services on: push: - branches: - - main + tags: + - 'v*' jobs: solver-build-deploy: diff --git a/cmd/lilypad/root.go b/cmd/lilypad/root.go index 0605cee6..48038777 100644 --- a/cmd/lilypad/root.go +++ b/cmd/lilypad/root.go @@ -19,7 +19,7 @@ func NewRootCmd() *cobra.Command { RootCmd := &cobra.Command{ Use: getCommandLineExecutable(), Short: "Lilypad", - Long: fmt.Sprintf("Lilypad: %s \nCommit: %s \n", VERSION, COMMIT_SHA), + Long: fmt.Sprintf("Lilypad: %s \nCommit: %s \n", version, commitSHA), } var network string diff --git a/cmd/lilypad/run.go b/cmd/lilypad/run.go index c796b270..37a34b97 100644 --- a/cmd/lilypad/run.go +++ b/cmd/lilypad/run.go @@ -57,8 +57,8 @@ func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions) error { ⠀⠀⠀⠀⠀⠈⠙⠛⠛⠘⠛⠋⠁⠀ ⠀⠀⠀ Decentralized Compute Network https://lilypad.tech ` - if VERSION != "" { - header = strings.Replace(header, "v2", VERSION, 1) + if version != "" { + header = strings.Replace(header, "v2", version, 1) } c.Print(header) diff --git a/cmd/lilypad/version.go b/cmd/lilypad/version.go index fc7bc596..1d4ceaab 100644 --- a/cmd/lilypad/version.go +++ b/cmd/lilypad/version.go @@ -9,11 +9,10 @@ import ( "github.com/lilypad-tech/lilypad/pkg/system" ) -var VERSION string +var version string +var commitSHA string -var COMMIT_SHA string - -const GO_BINARY_URL = "https://github.com/lilypad-tech/lilypad/releases/" +const goBinaryURL = "https://github.com/lilypad-tech/lilypad/releases/" func newVersionCmd() *cobra.Command { options := optionsfactory.NewSolverOptions() @@ -37,14 +36,14 @@ func runVersion(cmd *cobra.Command) error { commandCtx := system.NewCommandContext(cmd) defer commandCtx.Cleanup() - if VERSION == "" { - fmt.Printf("version not found: download the latest binary from %s", GO_BINARY_URL) + if version == "" { + fmt.Printf("version not found: download the latest binary from %s", goBinaryURL) // unnecessary help shows up when returned as error, so shortciruting here return nil } - fmt.Printf("Lilypad: %s\n", VERSION) - fmt.Printf("Commit: %s\n", COMMIT_SHA) + fmt.Printf("Lilypad: %s\n", version) + fmt.Printf("Commit: %s\n", commitSHA) // TODO: suggest updating to the latest version if the current version is not the latest version diff --git a/ops/lilypad-updater.sh b/ops/lilypad-updater-gpu.sh similarity index 96% rename from ops/lilypad-updater.sh rename to ops/lilypad-updater-gpu.sh index ef5faaaf..0c539330 100755 --- a/ops/lilypad-updater.sh +++ b/ops/lilypad-updater-gpu.sh @@ -9,7 +9,7 @@ OSNAME=$(uname -s | awk '{if ($1 == "Darwin") print "darwin"; else if ($1 == "Li export OSNAME # Get the latest version URL -LATEST_URL=$(curl -s https://api.github.com/repos/lilypad-tech/lilypad/releases/latest | grep "browser_download_url.*lilypad-$OSNAME-$OSARCH" | cut -d : -f 2,3 | tr -d \") +LATEST_URL=$(curl -s https://api.github.com/repos/lilypad-tech/lilypad/releases/latest | grep "browser_download_url.*lilypad-$OSNAME-$OSARCH-gpu" | cut -d : -f 2,3 | tr -d \") # Extract the latest version (including short SHA) from the URL LATEST_VERSION=$(echo $LATEST_URL | sed -n 's#.*/download/\([^/]*\)/.*#\1#p') @@ -24,18 +24,18 @@ if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then echo "Updating lilypad binary from version $CURRENT_VERSION to $LATEST_VERSION" sudo systemctl stop lilypad-resource-provider echo "Stopped the service: sudo systemctl stop lilypad-resource-provider" - + curl -L -o lilypad "$LATEST_URL" echo "Downloaded the latest version from $LATEST_URL" - + chmod +x lilypad sudo mv lilypad /usr/local/bin/lilypad echo "Made the new binary executable and moved it to /usr/local/bin/lilypad" - + sudo systemctl start lilypad-resource-provider echo "Restarted the service: sudo systemctl start lilypad-resource-provider" - + echo "Update complete." else echo "Lilypad binary is already up to date." -fi \ No newline at end of file +fi