Skip to content

Fix windows build

Fix windows build #20

Workflow file for this run

name: Rust Build and Release
on:
push:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Debug - List build directory
shell: bash
run: |
echo "Listing target/${{ matrix.target }}/release directory:"
ls -la target/${{ matrix.target }}/release
- name: Set binary name
run: |
BINARY_NAME="merklemap-cli"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV
- name: Package Binary
shell: bash
run: |
echo "Packaging binary from: target/${{ matrix.target }}/release/${BINARY_NAME}"
if [ -f "target/${{ matrix.target }}/release/${BINARY_NAME}" ]; then
echo "Binary file exists"
tar -czvf "${BINARY_NAME}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${BINARY_NAME}"
echo "Packaging complete"
else
echo "Error: Binary file not found"
exit 1
fi
- name: Debug - List workspace
shell: bash
run: |
echo "Listing current directory:"
ls -la
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: merklemap-cli-${{ matrix.target }}
path: merklemap-cli-${{ matrix.target }}.tar.gz