Skip to content

Conversation

ausias-armesto
Copy link
Contributor

@ausias-armesto ausias-armesto commented Nov 26, 2024

Allow to generate the hopli and hoprd binaries from a manual workflow and select a branch.

Copy link
Contributor

coderabbitai bot commented Nov 26, 2024

📝 Walkthrough

Walkthrough

The pull request introduces modifications to two GitHub Actions workflows: .github/workflows/build-binaries.yaml and .github/workflows/build.yaml. Key updates include the addition of a workflow_dispatch trigger with new inputs in the first file, while the second file introduces a conditional execution for the build-binaries job based on pull request labels. Additionally, both workflows have removed the runner_needs_nix_setup and package_suffix inputs, simplifying their configurations and improving the management of environment variables.

Changes

File Change Summary
.github/workflows/build-binaries.yaml - Added inputs: binary, runner, target under workflow_dispatch.
- Removed inputs: runner_needs_nix_setup, package_suffix.
- Simplified job execution conditions and updated environment variable handling.
.github/workflows/build.yaml - Added job condition: if: contains(github.event.pull_request.labels.*.name, 'binary') for build-binaries job.
- Removed package_suffix from job signature and matrix entries.

Possibly related PRs

  • Pipeline improvements #6551: The changes in this PR also modify the .github/workflows/build-binaries.yaml file, focusing on the workflow configuration for building binaries, which is directly related to the changes made in the main PR.
  • nix: Add patchelf step to cross-builds #6651: This PR modifies the .github/workflows/build-binaries.yaml file by removing the interpreter input parameter and adjusting the binary patching process, which aligns with the changes in the main PR that streamline the workflow for building binaries.

Suggested labels

devops, package:DAppNodePackage-Hopr-testnet

Suggested reviewers

  • Teebor-Choka

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ausias-armesto ausias-armesto added binary:x86_64-linux Build x86_64-linux binary binary:aarch64-linux Build aarch64-linux binary binary:aarch64-darwin Build aarch64-darwin binary binary:x86_64-darwin Build x86_64-darwin binary binary:armv7l-linux labels Nov 26, 2024
@ausias-armesto ausias-armesto added this to the 2.2.0-rc.1 milestone Nov 26, 2024
@github-actions github-actions bot added the toolchain Developer and product happiness label Nov 26, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build.yaml (1)

52-52: Document the required label format in workflow comments

The conditional execution based on the 'binary:' label is a good approach for manual control. However, it would be helpful to document the exact label format required to trigger the binary builds.

Add a comment above the job to explain the label requirement:

+    # Requires a label starting with 'binary:' to trigger the binary builds
+    # Example: binary:all, binary:hoprd, etc.
     if: contains(github.event.pull_request.labels.*.name, 'binary:')
.github/workflows/build-binaries.yaml (1)

Line range hint 98-101: Fix incorrect condition for Nix installation.

The condition still references the removed runner_needs_nix_setup input.

Apply this fix:

- if: inputs.runner_needs_nix_setup == true
+ if: env.GH_RUNNER_NEEDS_NIX_SETUP == 'true'
🧰 Tools
🪛 actionlint (1.7.4)

62-62: shellcheck reported issue in this script: SC1075:error:20:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


62-62: shellcheck reported issue in this script: SC1009:info:20:3: The mentioned syntax error was in this else clause

(shellcheck)


62-62: shellcheck reported issue in this script: SC1046:error:20:8: Couldn't find 'fi' for this 'if'

(shellcheck)


62-62: shellcheck reported issue in this script: SC1073:error:20:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


62-62: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


62-62: shellcheck reported issue in this script: SC1047:error:27:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


62-62: shellcheck reported issue in this script: SC1072:error:27:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)


62-62: property "test_id" is not defined in object type {binary: string; runner: string; target: string}

(expression)


98-98: property "runner_needs_nix_setup" is not defined in object type {binary: string; branch: string; runner: string; target: string}

(expression)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef8549 and d03b3b2.

📒 Files selected for processing (2)
  • .github/workflows/build-binaries.yaml (3 hunks)
  • .github/workflows/build.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

62-62: shellcheck reported issue in this script: SC1075:error:20:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


62-62: shellcheck reported issue in this script: SC1009:info:20:3: The mentioned syntax error was in this else clause

(shellcheck)


62-62: shellcheck reported issue in this script: SC1046:error:20:8: Couldn't find 'fi' for this 'if'

(shellcheck)


62-62: shellcheck reported issue in this script: SC1073:error:20:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


62-62: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


62-62: shellcheck reported issue in this script: SC1047:error:27:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


62-62: shellcheck reported issue in this script: SC1072:error:27:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)


62-62: property "test_id" is not defined in object type {binary: string; runner: string; target: string}

(expression)

🔇 Additional comments (4)
.github/workflows/build.yaml (2)

75-75: LGTM! Clean target configuration

The simplified target reference without package_suffix makes the configuration cleaner and more maintainable.


58-67: Verify runner capabilities for all architectures

The matrix configuration covers a good range of architectures. Let's verify the runner capabilities to ensure successful builds.

✅ Verification successful

Runner configuration is well-defined and consistent

The matrix configuration for runners is properly aligned with the build requirements:

  • Linux builds (x86_64, aarch64, armv7l) use self-hosted-hoprnet-bigger runners
  • macOS builds use appropriate GitHub-hosted runners (macos-14 for M1/aarch64, macos-13 for Intel/x86_64)
  • Runner options are consistently defined in both the matrix and workflow_dispatch inputs
  • The build-binaries workflow correctly handles the runner selection and architecture-specific configurations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check runner labels and recent workflow runs to verify architecture support

# Check recent workflow runs for these runners
gh run list --workflow=build.yaml --json conclusion,name,headBranch,status --jq '.[] | select(.name | contains("build-binaries")) | {name: .name, conclusion: .conclusion, branch: .headBranch}' --limit 10

# List available runner labels
gh api repos/$GITHUB_REPOSITORY/actions/runners --jq '.runners[] | {name: .name, labels: .labels[].name}'

Length of output: 409


Script:

#!/bin/bash
# Let's verify the workflow configuration and runner usage patterns

# Check the workflow file content
cat .github/workflows/build.yaml

# Search for any related workflow files that might reference these runners
fd -e yaml -e yml . .github/workflows/ --exec grep -l "runner:"

# Look for any documentation about runners
fd README -t f | xargs grep -l "runner" || true

Length of output: 2786


Script:

#!/bin/bash
# Let's check the build-binaries workflow to understand runner requirements
cat .github/workflows/build-binaries.yaml

# Also check if there are any recent changes to runner configurations
fd -e yaml -e yml . .github/workflows/ --exec grep -A 5 -B 5 "runner:"

Length of output: 5087

.github/workflows/build-binaries.yaml (2)

23-50: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger configuration is well-organized with clear descriptions and appropriate choices for each input.


115-119: LGTM! Well-structured artifact configuration.

The artifact naming and path configuration is correct and follows best practices.

@ausias-armesto ausias-armesto changed the title Allow to launch manually binaries Allow to launch binaries manually Nov 26, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-binaries.yaml (1)

Line range hint 98-106: Fix the Nix setup condition.

The condition still references the removed input runner_needs_nix_setup. It should use the environment variable instead.

Apply this fix:

-        if: inputs.runner_needs_nix_setup == true
+        if: env.GH_RUNNER_NEEDS_NIX_SETUP == 'true'
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 956c757 and bcd1d2e.

📒 Files selected for processing (2)
  • .github/workflows/build-binaries.yaml (3 hunks)
  • .github/workflows/build.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yaml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC1075:error:20:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:20:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:20:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:20:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:27:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:27:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)

🔇 Additional comments (3)
.github/workflows/build-binaries.yaml (3)

23-50: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger configuration is well-defined with clear descriptions, appropriate required flags, and comprehensive options for all inputs.


51-54: LGTM! Effective concurrency control.

The concurrency configuration properly prevents parallel builds of the same binary/target combination and efficiently manages resources by canceling outdated builds.


61-91: Previous review comment about shell script issues is still valid.

The shell script still contains syntax errors and could benefit from the improvements suggested in the previous review.

🧰 Tools
🪛 actionlint (1.7.4)

63-63: shellcheck reported issue in this script: SC1075:error:20:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:20:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:20:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:20:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:27:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:27:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bcd1d2e and c551165.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC1075:error:20:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:20:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:20:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:20:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:27:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:27:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)

🔇 Additional comments (3)
.github/workflows/build-binaries.yaml (3)

23-50: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger configuration is well-defined with clear descriptions, appropriate required flags, and comprehensive options for different architectures.


57-58: The job condition needs to be fixed for workflow_dispatch events.

The current condition might cause issues as noted in the previous review.


120-126: LGTM! Build and upload steps are properly configured.

The steps correctly use the environment variables set in previous steps.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build-binaries.yaml (2)

23-49: Enhance input descriptions for better clarity.

The workflow_dispatch configuration is well-structured, but consider these improvements:

  1. The runner description only mentions macOS options but includes self-hosted-hoprnet-bigger
  2. The binary options (hoprd and hopli) would benefit from descriptions explaining their purpose
       binary:
         required: true
-        description: 'Binary to build'
+        description: 'Binary to build (hoprd: HOPR node daemon, hopli: HOPR command-line interface)'
         type: choice
         options:
           - hoprd
           - hopli
       runner:
         type: choice
         options:
           - self-hosted-hoprnet-bigger
           - macos-13
           - macos-14
         required: true
-        description: 'GH Runner to use: macos-13=x86_64-darwin and macos-14=aarch64-darwin'
+        description: 'GH Runner to use: self-hosted=Linux builds, macos-13=x86_64-darwin, macos-14=aarch64-darwin'

Line range hint 108-116: Fix Nix installation condition.

The Nix installation step is still using the removed input runner_needs_nix_setup. It should use the environment variable instead.

       - name: Install Nix
-        if: inputs.runner_needs_nix_setup == true
+        if: env.GH_RUNNER_NEEDS_NIX_SETUP == 'true'
         uses: cachix/install-nix-action@v29
         with:
           github_access_token: ${{ secrets.GITHUB_TOKEN }}
           nix_path: nixpkgs=channel:nixos-24.05

       - uses: cachix/cachix-action@v15
-        if: env.GH_RUNNER_NEEDS_NIX_SETUP == true
+        if: env.GH_RUNNER_NEEDS_NIX_SETUP == 'true'
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c551165 and 3081c7b.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC1075:error:23:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:23:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:23:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:23:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:26:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:30:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:30:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)

🔇 Additional comments (2)
.github/workflows/build-binaries.yaml (2)

51-54: LGTM! Well-configured concurrency settings.

The concurrency configuration is properly scoped and follows best practices by canceling redundant runs.


Line range hint 123-131: LGTM! Well-structured build and upload steps.

The build and upload steps are properly configured with clear artifact naming and correct use of environment variables.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-binaries.yaml (1)

Line range hint 110-117: Fix inconsistent Nix setup conditions.

The conditions for Nix setup are inconsistent:

  • Install Nix step uses inputs.runner_needs_nix_setup
  • Cachix step uses env.GH_RUNNER_NEEDS_NIX_SETUP

This could lead to unexpected behavior where Nix is installed but Cachix is not configured, or vice versa.

Apply this fix:

-      - name: Install Nix
-        if: inputs.runner_needs_nix_setup == true
+      - name: Install Nix
+        if: env.GH_RUNNER_NEEDS_NIX_SETUP == 'true'
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3081c7b and 32cc010.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC1075:error:24:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:24:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:24:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:24:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:27:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:31:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:31:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)

🔇 Additional comments (4)
.github/workflows/build-binaries.yaml (4)

23-50: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger configuration is well-designed with:

  • Clear input descriptions
  • Proper validation through choice constraints
  • Logical grouping of runner and target architecture options

57-58: Fix job condition and runner selection.

This issue was previously identified but hasn't been fully addressed. Please refer to the previous review comment for the detailed fix:
#6681 (comment)


61-102: Fix shell script syntax and improve error handling.

These issues were previously identified but haven't been fully addressed. Please refer to the previous review comment for the detailed fix:
#6681 (comment)

🧰 Tools
🪛 actionlint (1.7.4)

63-63: shellcheck reported issue in this script: SC1075:error:24:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:24:3: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:24:8: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:24:8: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:27:3: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:31:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:31:2: Unexpected keyword/token. Fix any mentioned problems and try again

(shellcheck)


124-131: LGTM! Well-configured build and upload steps.

The build and upload steps are properly configured with:

  • Consistent use of environment variables
  • Proper artifact naming and paths

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build-binaries.yaml (2)

25-49: Enhance input descriptions for better clarity.

The workflow_dispatch inputs could be more descriptive:

  1. For binary input, include brief descriptions of what each binary does (hoprd/hopli)
  2. For target input, consider grouping options by platform (Linux/Darwin) for better organization
       binary:
         required: true
-        description: 'Binary to build'
+        description: 'Binary to build (hoprd: HOPR node daemon, hopli: HOPR CLI tool)'
         type: choice
         options:
           - hoprd
           - hopli
       target:
         type: choice
         options:
+          # Linux targets
           - x86_64-linux
           - aarch64-linux
           - armv7l-linux
+          # Darwin targets
           - x86_64-darwin
           - aarch64-darwin
         required: true
-        description: 'Architecture to build for'
+        description: 'Target architecture and platform to build for (Linux/Darwin)'

123-124: Add error handling for build step.

The build step should include error handling to ensure failures are properly caught and reported.

       - name: Build ${{ steps.vars.outputs.binary }} binaries
-        run: nix build .#${{ steps.vars.outputs.binary }}${{ steps.vars.outputs.package_suffix }} -L
+        run: |
+          set -eo pipefail
+          if ! nix build .#${{ steps.vars.outputs.binary }}${{ steps.vars.outputs.package_suffix }} -L; then
+            echo "::error::Failed to build ${{ steps.vars.outputs.binary }} for ${{ steps.vars.outputs.target }}"
+            exit 1
+          fi
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 32cc010 and 4355ef1.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC1075:error:17:1: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1009:info:17:1: The mentioned syntax error was in this else clause

(shellcheck)


63-63: shellcheck reported issue in this script: SC1046:error:17:6: Couldn't find 'fi' for this 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1073:error:17:6: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


63-63: shellcheck reported issue in this script: SC1075:error:20:1: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)

(shellcheck)


63-63: shellcheck reported issue in this script: SC1047:error:39:1: Expected 'fi' matching previously mentioned 'if'

(shellcheck)


63-63: shellcheck reported issue in this script: SC1072:error:39:1: Expected 'fi'. Fix any mentioned problems and try again

(shellcheck)

🔇 Additional comments (1)
.github/workflows/build-binaries.yaml (1)

57-58: Referencing existing review comment.

This issue was already identified in a previous review. Please refer to the existing comment about fixing the job condition and simplifying runner selection.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-binaries.yaml (1)

123-124: Add error handling for the build step.

The build step should handle potential failures gracefully and provide clear error messages.

      - name: Build ${{ steps.vars.outputs.binary }} binaries
        run: |
+         set -eo pipefail
+         echo "::group::Building ${{ steps.vars.outputs.binary }}"
          nix build .#${{ steps.vars.outputs.binary }}${{ steps.vars.outputs.package_suffix }} -L
+         if [ ! -d "result/bin" ]; then
+           echo "::error::Build failed: Binary not found in result/bin"
+           exit 1
+         fi
+         echo "::endgroup::"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4355ef1 and d4e7b7a.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC2086:info:30:6: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (2)
.github/workflows/build-binaries.yaml (2)

23-50: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger is well-defined with appropriate input validations and clear descriptions.


57-58: 🛠️ Refactor suggestion

Improve job condition and runner selection.

The current implementation can be improved for better clarity and reliability:

  1. The condition should explicitly handle workflow_dispatch events
  2. The runner selection can be simplified
-    if: contains(github.event.pull_request.labels.*.name, format('binary:{0}', inputs.target)) || github.event.inputs.binary
-    runs-on: ${{ inputs.runner || github.event.inputs.runner }}
+    if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_call' && contains(github.event.pull_request.labels.*.name, format('binary:{0}', inputs.target)))
+    runs-on: ${{ github.event.inputs.runner || inputs.runner }}

Likely invalid or redundant comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build-binaries.yaml (2)

25-49: Enhance input descriptions for better clarity.

Consider adding more detailed descriptions:

  1. For the binary input, describe what each option represents
  2. For the runner input, make the architecture mapping more explicit
       binary:
         required: true
-        description: 'Binary to build'
+        description: 'Binary to build: hoprd (node daemon) or hopli (command-line interface)'
         type: choice
         options:
           - hoprd
           - hopli
       runner:
         type: choice
         options:
           - self-hosted-hoprnet-bigger
           - macos-13
           - macos-14
         required: true
-        description: 'GH Runner to use: macos-13=x86_64-darwin and macos-14=aarch64-darwin'
+        description: 'Runner to use: self-hosted-hoprnet-bigger (Linux), macos-13 (x86_64-darwin), macos-14 (aarch64-darwin)'

102-117: Enhance build steps with timeouts and error handling.

Consider adding:

  1. Timeout for Nix installation
  2. Error handling for the build step
  3. Build status verification
       - name: Install Nix
         if: steps.vars.outputs.runner_needs_nix_setup == 'true'
         uses: cachix/install-nix-action@v29
+        timeout-minutes: 5
         with:
           github_access_token: ${{ secrets.GITHUB_TOKEN }}
           nix_path: nixpkgs=channel:nixos-24.05

       - uses: cachix/cachix-action@v15
         if: steps.vars.outputs.runner_needs_nix_setup == 'true'
+        timeout-minutes: 5
         with:
           name: hoprnet
           authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
         env:
           USER: runner

       - name: Build ${{ steps.vars.outputs.binary }} binaries
-        run: nix build .#${{ steps.vars.outputs.binary }}${{ steps.vars.outputs.package_suffix }} -L
+        run: |
+          set -eo pipefail
+          nix build .#${{ steps.vars.outputs.binary }}${{ steps.vars.outputs.package_suffix }} -L
+          if [ ! -f "result/bin/${{ steps.vars.outputs.binary }}" ]; then
+            echo "::error::Build failed: Binary not found at expected location"
+            exit 1
+          fi
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9ac6b2c and 88259e6.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC2086:info:25:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:26:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:27:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:28:50: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:29:66: Double quote to prevent globbing and word splitting

(shellcheck)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-binaries.yaml (1)

105-109: Consider making Nix path configurable.

The Nix path is hardcoded to nixos-24.05. Consider making it configurable through workflow inputs or repository variables for better maintainability.

       - name: Install Nix
         if: steps.vars.outputs.runner_needs_nix_setup == 'true'
         uses: cachix/install-nix-action@v29
         with:
           github_access_token: ${{ secrets.GITHUB_TOKEN }}
-          nix_path: nixpkgs=channel:nixos-24.05
+          nix_path: nixpkgs=channel:${{ vars.NIX_CHANNEL || 'nixos-24.05' }}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 88259e6 and 0af6185.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

63-63: shellcheck reported issue in this script: SC2086:info:28:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:29:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:30:34: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:31:50: Double quote to prevent globbing and word splitting

(shellcheck)


63-63: shellcheck reported issue in this script: SC2086:info:32:66: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (2)
.github/workflows/build-binaries.yaml (2)

57-58: ⚠️ Potential issue

Improve job condition robustness.

The current condition may fail when accessing github.event.pull_request.labels during workflow_dispatch events. Consider using event-specific conditions.

-    if: contains(github.event.pull_request.labels.*.name, format('binary:{0}', inputs.target)) || github.event.inputs.binary
-    runs-on: ${{ inputs.runner || github.event.inputs.runner }}
+    if: >-
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.binary != '') ||
+      (github.event_name == 'workflow_call' && inputs.target != '' && contains(github.event.pull_request.labels.*.name, format('binary:{0}', inputs.target)))
+    runs-on: ${{ github.event.inputs.runner || inputs.runner }}

Likely invalid or redundant comment.


32-49: Verify runner-target compatibility.

The runner options don't cover all possible target architectures. For example, there's no runner option specified for armv7l-linux target. This mismatch could lead to build failures.

@ausias-armesto ausias-armesto removed binary:aarch64-linux Build aarch64-linux binary binary:aarch64-darwin Build aarch64-darwin binary binary:x86_64-darwin Build x86_64-darwin binary binary:armv7l-linux labels Nov 26, 2024
@ausias-armesto
Copy link
Contributor Author

All binaries are available at this workflow

@ausias-armesto ausias-armesto requested a review from a team November 26, 2024 18:09
@ausias-armesto ausias-armesto removed the binary:x86_64-linux Build x86_64-linux binary label Nov 26, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0af6185 and 861912b.

📒 Files selected for processing (1)
  • .github/workflows/build-binaries.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-binaries.yaml

65-65: shellcheck reported issue in this script: SC2086:info:32:34: Double quote to prevent globbing and word splitting

(shellcheck)


65-65: shellcheck reported issue in this script: SC2086:info:33:34: Double quote to prevent globbing and word splitting

(shellcheck)


65-65: shellcheck reported issue in this script: SC2086:info:34:34: Double quote to prevent globbing and word splitting

(shellcheck)


65-65: shellcheck reported issue in this script: SC2086:info:35:50: Double quote to prevent globbing and word splitting

(shellcheck)


65-65: shellcheck reported issue in this script: SC2086:info:36:66: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (2)
.github/workflows/build-binaries.yaml (2)

23-49: LGTM! Well-structured workflow_dispatch configuration.

The manual trigger configuration is well-designed with:

  • Clear descriptions for each input
  • Appropriate required flags
  • Comprehensive options for different architectures and runners

104-132: LGTM! Well-structured build steps configuration.

The build steps are properly configured with:

  • Appropriate use of environment variables from the vars step
  • Conditional Nix installation based on runner type
  • Proper artifact upload configuration

@Teebor-Choka
Copy link
Contributor

Deploy where?

@ausias-armesto ausias-armesto linked an issue Nov 26, 2024 that may be closed by this pull request
@ausias-armesto ausias-armesto self-assigned this Nov 26, 2024
@ausias-armesto
Copy link
Contributor Author

Deploy where?

The binaries are just compiled and published in the workflow run. We still don't have an environment specified for those binaries.

@ausias-armesto ausias-armesto merged commit 9b57910 into master Nov 27, 2024
28 of 30 checks passed
@ausias-armesto ausias-armesto deleted the ausias/launch-binaries-manually branch November 27, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain Developer and product happiness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to generate binaries from specific branch
2 participants