Fix windows build #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Package Binary | |
shell: bash | |
run: | | |
binary_name="merklemap-cli" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
binary_name="${binary_name}.exe" | |
fi | |
echo "Binary name: ${binary_name}" | |
echo "Packaging binary from: target/${{ matrix.target }}/release/${binary_name}" | |
if [ -f "target/${{ matrix.target }}/release/${binary_name}" ]; then | |
echo "Binary file exists" | |
tar -czv "${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 | |
- name: Debug - Check upload | |
shell: bash | |
run: | | |
echo "Checking if tar.gz file exists:" | |
ls -la merklemap-cli-${{ matrix.target }}.tar.gz || echo "File not found" |