From 1c6fded688ce0ba58608206d50271fcf903f1891 Mon Sep 17 00:00:00 2001 From: erhant Date: Wed, 4 Dec 2024 16:57:20 +0300 Subject: [PATCH] fix workflows --- .github/workflows/build_dev_exe.yml | 53 +++++++++++++++++++++------- .github/workflows/build_prod_exe.yml | 53 +++++++++++++++++++++------- Cargo.toml | 4 +++ Dockerfile | 2 +- 4 files changed, 87 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build_dev_exe.yml b/.github/workflows/build_dev_exe.yml index 8800987..d21a6e1 100644 --- a/.github/workflows/build_dev_exe.yml +++ b/.github/workflows/build_dev_exe.yml @@ -8,9 +8,8 @@ permissions: contents: write jobs: - check_release: - if: "contains(github.event.release.tag_name, '-dev')" # continue if the tag ends with -dev + if: "contains(github.event.release.tag_name, '-dev')" # continue if the tag ends with -dev runs-on: ubuntu-latest steps: - name: Echo tag @@ -24,11 +23,43 @@ jobs: strategy: matrix: include: - - { runner: macos-latest, osname: macOS, arch: amd64, target: x86_64-apple-darwin, command: build } - - { runner: macos-latest, osname: macOS, arch: arm64, target: aarch64-apple-darwin, command: build } - - { runner: ubuntu-latest, osname: linux, arch: amd64, target: x86_64-unknown-linux-gnu, command: build } - - { runner: ubuntu-latest, osname: linux, arch: arm64, target: aarch64-unknown-linux-gnu, command: build, build_args: --no-default-features } - - { runner: windows-latest, osname: windows, arch: amd64, target: x86_64-pc-windows-msvc, command: build, extension: ".exe" } + - { + runner: macos-latest, + osname: macOS, + arch: amd64, + target: x86_64-apple-darwin, + command: build, + } + - { + runner: macos-latest, + osname: macOS, + arch: arm64, + target: aarch64-apple-darwin, + command: build, + } + - { + runner: ubuntu-latest, + osname: linux, + arch: amd64, + target: x86_64-unknown-linux-gnu, + command: build, + } + - { + runner: ubuntu-latest, + osname: linux, + arch: arm64, + target: aarch64-unknown-linux-gnu, + command: build, + build_args: --no-default-features, + } + - { + runner: windows-latest, + osname: windows, + arch: amd64, + target: x86_64-pc-windows-msvc, + command: build, + extension: ".exe", + } # - { runner: windows-latest, osname: windows, arch: arm64, target: aarch64-pc-windows-msvc, command: build, extension: ".exe", toolchain: nightly } steps: @@ -44,14 +75,13 @@ jobs: with: command: ${{ matrix.command }} target: ${{ matrix.target }} - args: "--locked --release ${{ matrix.build_args }}" + args: "--bin dkn-compute --locked --release ${{ matrix.build_args }}" strip: true - name: Prepare Release File run: | # move the binary mv target/${{ matrix.target }}/release/dkn-compute${{ matrix.extension }} ./dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} - - name: Upload Launch Artifacts uses: actions/upload-artifact@v4 @@ -59,16 +89,15 @@ jobs: name: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }} path: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} - release: needs: build runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 0 # Fetch all tags and history + fetch-depth: 0 # Fetch all tags and history - name: Download Launch Artifacts uses: actions/download-artifact@v4 diff --git a/.github/workflows/build_prod_exe.yml b/.github/workflows/build_prod_exe.yml index ca4d4c1..e37f28b 100644 --- a/.github/workflows/build_prod_exe.yml +++ b/.github/workflows/build_prod_exe.yml @@ -8,9 +8,8 @@ permissions: contents: write jobs: - check_release: - if: "! contains(github.event.release.tag_name, '-dev')" # skip if the tag ends with -dev + if: "! contains(github.event.release.tag_name, '-dev')" # skip if the tag ends with -dev runs-on: ubuntu-latest steps: - name: Echo tag @@ -24,11 +23,43 @@ jobs: strategy: matrix: include: - - { runner: macos-latest, osname: macOS, arch: amd64, target: x86_64-apple-darwin, command: build } - - { runner: macos-latest, osname: macOS, arch: arm64, target: aarch64-apple-darwin, command: build } - - { runner: ubuntu-latest, osname: linux, arch: amd64, target: x86_64-unknown-linux-musl, command: build } - - { runner: ubuntu-latest, osname: linux, arch: arm64, target: aarch64-unknown-linux-musl, command: build, build_args: --no-default-features } - - { runner: windows-latest, osname: windows, arch: amd64, target: x86_64-pc-windows-msvc, command: build, extension: ".exe" } + - { + runner: macos-latest, + osname: macOS, + arch: amd64, + target: x86_64-apple-darwin, + command: build, + } + - { + runner: macos-latest, + osname: macOS, + arch: arm64, + target: aarch64-apple-darwin, + command: build, + } + - { + runner: ubuntu-latest, + osname: linux, + arch: amd64, + target: x86_64-unknown-linux-musl, + command: build, + } + - { + runner: ubuntu-latest, + osname: linux, + arch: arm64, + target: aarch64-unknown-linux-musl, + command: build, + build_args: --no-default-features, + } + - { + runner: windows-latest, + osname: windows, + arch: amd64, + target: x86_64-pc-windows-msvc, + command: build, + extension: ".exe", + } # - { runner: windows-latest, osname: windows, arch: arm64, target: aarch64-pc-windows-msvc, command: build, extension: ".exe", toolchain: nightly } steps: @@ -44,14 +75,13 @@ jobs: with: command: ${{ matrix.command }} target: ${{ matrix.target }} - args: "--locked --release ${{ matrix.build_args }}" + args: "--bin dkn-compute --locked --release ${{ matrix.build_args }}" strip: true - name: Prepare Release File run: | # move the binary mv target/${{ matrix.target }}/release/dkn-compute${{ matrix.extension }} ./dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} - - name: Upload Launch Artifacts uses: actions/upload-artifact@v4 @@ -59,16 +89,15 @@ jobs: name: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }} path: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} - release: needs: build runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 0 # Fetch all tags and history + fetch-depth: 0 # Fetch all tags and history - name: Download Launch Artifacts uses: actions/download-artifact@v4 diff --git a/Cargo.toml b/Cargo.toml index 840fe4d..033ad29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,10 @@ resolver = "2" members = ["compute", "p2p", "workflows", "utils", "monitor"] +# compute node is the default member, until Oracle comes in +# then, a Launcher will be the default member +default-members = ["compute"] + [workspace.package] edition = "2021" version = "0.2.26" diff --git a/Dockerfile b/Dockerfile index 6621725..5fbbab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN echo "Target platform: $TARGETPLATFORM" # build release binary WORKDIR /usr/src/app COPY . . -RUN cargo build --release +RUN cargo build --bin dkn-compute --release # copy release binary to distroless FROM --platform=$BUILDPLATFORM gcr.io/distroless/cc