Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
include:
- target: x86_64-unknown-linux-gnu
binary: test-binary
- target: x86_64-pc-windows-gnu
binary: test-binary.exe
steps:
- uses: actions/checkout@v4

Expand All @@ -591,17 +594,33 @@ jobs:
with:
target: ${{ matrix.target }}

- name: Test build-binary action
- name: Install mingw-w64 for Windows GNU target
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64

- name: Build binary
working-directory: test-binary
run: |
cargo build --release --target ${{ matrix.target }} --verbose
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" || "${{ matrix.target }}" == "aarch64-pc-windows-msvc" ]]; then
cross build --release --target ${{ matrix.target }} --verbose
else
cargo build --release --target ${{ matrix.target }} --verbose
fi

- name: Verify binary was built
run: |
cd test-binary
test -f target/${{ matrix.target }}/release/test-binary
echo "✓ Binary built successfully"
./target/${{ matrix.target }}/release/test-binary
test -f target/${{ matrix.target }}/release/${{ matrix.binary }}
echo "✓ Binary built successfully for ${{ matrix.target }}"
ls -lh target/${{ matrix.target }}/release/${{ matrix.binary }}

- name: Execute binary (Linux only)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
cd test-binary
./target/${{ matrix.target }}/release/${{ matrix.binary }}

test-verify-toolchain:
name: Test rust/verify-toolchain
Expand Down
82 changes: 82 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,88 @@ Before submitting a PR, ensure:
6. **Signed commits**: All commits must be GPG or SSH signed
7. **Security scanning**: All actions undergo security analysis

## Supported Build Targets

The Rust actions support building binaries for multiple target architectures:

### Linux Targets

**Native Builds (using `cargo`):**
- `x86_64-unknown-linux-gnu` - x86_64 Linux with GNU libc
- `x86_64-unknown-linux-musl` - x86_64 Linux with musl libc

**Cross-Compilation Builds (using `cross`):**
- `aarch64-unknown-linux-gnu` - ARM64 Linux with GNU libc
- `aarch64-unknown-linux-musl` - ARM64 Linux with musl libc

### Windows Targets

**Cross-Compilation from Linux (using `cargo`):**
- `x86_64-pc-windows-msvc` - x86_64 Windows with MSVC toolchain (recommended)
- `x86_64-pc-windows-gnu` - x86_64 Windows with GNU/MinGW-w64 toolchain

**Cross-Compilation from Linux (using `cross`):**
- `aarch64-pc-windows-msvc` - ARM64 Windows with MSVC toolchain

**Choosing Between Windows MSVC and GNU:**

MSVC (`x86_64-pc-windows-msvc`):
- Uses Microsoft Visual C++ toolchain
- Better integration with Windows ecosystem
- Best compatibility with Windows APIs
- **Requires Windows runners** (`runs-on: windows-latest`)
- Cannot cross-compile from Linux without complex setup (xwin)
- Recommended for production Windows deployments

GNU (`x86_64-pc-windows-gnu`) - **Recommended for CI/CD**:
- Uses MinGW-w64 toolchain
- **Works on Linux runners** with mingw-w64 installed
- Better for cross-platform CI pipelines on Linux runners
- Requires mingw-w64 installation: `sudo apt-get install mingw-w64`
- Good compatibility with most Windows applications
- Simpler and faster for Linux-based CI/CD

**CI/CD Recommendation**:
- Use `x86_64-pc-windows-gnu` on Linux runners (ubuntu-latest)
- Use `x86_64-pc-windows-msvc` on Windows runners (windows-latest)
- Both produce fully functional Windows executables

### macOS Targets

- `x86_64-apple-darwin` - x86_64 macOS (Intel)
- `aarch64-apple-darwin` - ARM64 macOS (Apple Silicon)

### Target-Specific Requirements

**Windows GNU Target (`x86_64-pc-windows-gnu`):**
```yaml
- name: Install mingw-w64
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
```

**Cross-compilation targets (require Docker):**
- `aarch64-unknown-linux-gnu` - ARM64 Linux
- `aarch64-pc-windows-msvc` - ARM64 Windows

These targets automatically use the `cross` tool which requires Docker to be available on the runner.

### Binary Output Paths

**Linux binaries:**
```
target/{target}/release/{binary-name}
Example: target/x86_64-unknown-linux-gnu/release/my-app
```

**Windows binaries (include .exe extension):**
```
target/{target}/release/{binary-name}.exe
Example: target/x86_64-pc-windows-msvc/release/my-app.exe
```

## Technologies and Tools

### Core Technologies
Expand Down
Loading
Loading