Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tarampampam
Copy link
Owner

@tarampampam tarampampam commented Dec 4, 2025

Implemented a new job in the GitHub Actions workflow to build the project for macOS on both Intel and Apple Silicon architectures.

Closes #11

Implemented a new job in the GitHub Actions workflow to build the project for macOS on both Intel and Apple Silicon architectures. This enhancement allows for better compatibility and testing across different macOS environments. The build process includes installing necessary dependencies and verifying the output binaries.
Included an additional linker flag for static linking to enhance portability of the built binaries. This change allows for better compatibility across different environments by reducing dependencies on shared libraries.
Modified the linker flags in the CI workflow to set the target architecture correctly and unset the static linking option. This change ensures compatibility with the build process on macOS.
Adjusted the order of linker flags in the Makefile to improve readability and maintainability. This change ensures that the static linking option is clearly defined and enhances the overall structure of the build configuration.
Refined linker flags in the CI workflow to improve build performance and clarity. Adjusted flags to enhance compatibility with macOS architecture and removed unnecessary static linking options.
Refactored linker flags in the Makefile for better clarity and organization. Added macOS-specific flags to enhance compatibility and ensure proper static linking. Updated build commands in the GitHub Actions workflow to utilize the new flags, improving the overall build process and maintainability.
Added support for ICMP error reporting in the UDP port checking function on Linux systems. This enhancement allows for better error handling and reporting when checking UDP ports, improving the reliability of the portcheck utility.
Updated the GitHub Actions workflows to use actions/checkout@v6 for improved performance and compatibility. Adjusted build commands to align with the new checkout version, ensuring consistent behavior across different environments.
Reverted actions/checkout version from v6 to v4 in CI workflows to maintain compatibility with existing configurations. This change ensures stability in the build process while we assess the impact of the newer version.
Updated the actions/checkout version from v4 to v6 in the CI workflows to leverage the latest features and improvements. This change ensures better compatibility and performance in the continuous integration process.
Eliminated the cmake installation step from the GitHub Actions CI workflow to streamline the build process. This change reduces unnecessary dependencies and speeds up the workflow execution time.
Modified the CI workflow to include execution of built binaries for verification. This change ensures that the binaries are correctly built and functional as part of the testing process. Removed redundant help commands for unused binaries to streamline the output.
Implemented separate jobs for publishing macOS binary files in the GitHub Actions release workflow. This enhancement allows for better support of macOS architectures, including Intel and Apple Silicon, ensuring that users can easily access the appropriate binaries. The workflow now also generates and uploads both tar.gz and zip formats for the binaries.
Clarified the README to include information about precompiled binaries for macOS in the multi-architecture support section. This enhances user understanding of available binaries and their compatibility across different platforms.
Added a note in the README to specify that users must explicitly provide the target host and port using flags or environment variables, rather than as positional arguments. This change aims to prevent confusion and ensure correct usage of the portcheck tool.
@tarampampam tarampampam marked this pull request as ready for review December 4, 2025 12:55
Copilot AI review requested due to automatic review settings December 4, 2025 12:55
@tarampampam tarampampam added the type:feature PR that introduces a new feature label Dec 4, 2025
@tarampampam tarampampam merged commit 51f1e52 into master Dec 4, 2025
18 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds macOS build support to the GitHub Actions CI/CD pipeline, enabling binary releases for both Intel (x86_64) and Apple Silicon (arm64) architectures. The changes include platform-specific build configuration in the Makefile, conditional compilation of Linux-specific socket code, and new CI/CD jobs for building and releasing macOS binaries.

Key Changes:

  • Added platform-specific Makefile configuration to support macOS linker flags and strip options
  • Wrapped Linux-specific socket option IP_RECVERR with #ifdef __linux__ for cross-platform compatibility
  • Created new GitHub Actions jobs (build-macos and binary-files-macos) for building and releasing macOS binaries
  • Updated documentation to mention macOS binary availability and clarify command-line usage

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/portcheck.c Added #ifdef __linux__ guard around Linux-specific IP_RECVERR socket option
Makefile Reorganized compiler/linker flags, added macOS-specific linker flags and strip options, added LDFLAGS to all build targets, included http_test in test suite
.github/workflows/tests.yml Updated actions/checkout version, added build-macos job with matrix for x86_64 and arm64 architectures
.github/workflows/release.yml Renamed binary-files job to binary-files-linux, added binary-files-macos job for publishing macOS binaries, updated dependencies for generate-checksums job
README.md Added mention of macOS precompiled binaries, added NOTE clarifying command-line usage for portcheck

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +46 to +50
- run: make CC=clang C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"
- run: |
ls -lh ./build/bin/
./build/bin/httpcheck --help # try to execute some binaries
./build/bin/httpscheck --help
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The macOS build job doesn't run the test suite (make test), unlike the Linux build job which runs both make and make test. To ensure consistent quality across platforms, consider adding - run: make test after the build step to verify the binaries work correctly on macOS.

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +64
* **Multi-arch and cross-compiled** (x86_64, ARM, etc.), even for macOS you may find precompiled binaries in
the releases
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The sentence structure is awkward. Consider rephrasing to: "Multi-arch and cross-compiled (x86_64, ARM, etc.); macOS precompiled binaries are available in the releases"

Suggested change
* **Multi-arch and cross-compiled** (x86_64, ARM, etc.), even for macOS you may find precompiled binaries in
the releases
* **Multi-arch and cross-compiled** (x86_64, ARM, etc.); macOS precompiled binaries are available in the releases

Copilot uses AI. Check for mistakes.
-R .note.gnu.build-id -R .gnu.hash -R .eh_frame -R .eh_frame_hdr

ifeq ($(shell uname -s),Darwin) # macOS linker flags (https://github.com/tarampampam/microcheck/issues/11)
C_LDFLAGS = -Wl,-dead_strip
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The macOS linker flags override on line 18 doesn't include $(C_LDFLAGS_EXTRA), which means the -arch flag passed from the GitHub Actions workflow won't be applied during linking. This should be: C_LDFLAGS = -Wl,-dead_strip $(C_LDFLAGS_EXTRA) to ensure the architecture flag is properly included.

Suggested change
C_LDFLAGS = -Wl,-dead_strip
C_LDFLAGS = -Wl,-dead_strip $(C_LDFLAGS_EXTRA)

Copilot uses AI. Check for mistakes.
- {arch: arm64, runner: macos-14} # Apple Silicon runner
steps:
- uses: actions/checkout@v6
- run: make CC=clang C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The -arch flag is being passed only as a linker flag (C_LDFLAGS_EXTRA), but it also needs to be passed during the compilation phase. On macOS, object files need to be compiled for the target architecture. Consider passing the architecture flag as part of CFLAGS or as a separate variable that's included in both CFLAGS and LDFLAGS. For example: make CC=clang CFLAGS="... -arch ${{ matrix.arch }}" C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"

Suggested change
- run: make CC=clang C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"
- run: make CC=clang CFLAGS="-arch ${{ matrix.arch }}" C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"

Copilot uses AI. Check for mistakes.
- {arch: arm64, runner: macos-14} # Apple Silicon runner
steps:
- uses: actions/checkout@v6
- run: make CC=clang C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Same issue as in tests.yml: The -arch flag is being passed only as a linker flag (C_LDFLAGS_EXTRA), but it also needs to be passed during the compilation phase. Additionally, the macOS-specific C_LDFLAGS override on line 18 of the Makefile doesn't include $(C_LDFLAGS_EXTRA), so the linker won't receive the -arch flag either.

Suggested change
- run: make CC=clang C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"
- run: make CC=clang C_CFLAGS_EXTRA="-arch ${{ matrix.arch }}" C_LDFLAGS_EXTRA="-arch ${{ matrix.arch }}"

Copilot uses AI. Check for mistakes.
@tarampampam tarampampam deleted the feat/macos branch December 4, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature PR that introduces a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MacOS

2 participants