Build and Release versa-wasm #16
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: Build and Release versa-wasm | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-release-wasm: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# - os: ubuntu-latest | |
# target: x86_64-unknown-linux-musl | |
# - os: ubuntu-latest | |
# target: x86_64-unknown-freebsd | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# - os: macos-latest | |
# target: aarch64-apple-darwin | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
# - os: windows-latest | |
# target: aarch64-pc-windows-msvc | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install Cross-Compilation Tools for aarch64-linux-musl | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools musl-dev gcc-aarch64-linux-gnu | |
# Verify if aarch64-linux-musl-gcc is correctly installed | |
which aarch64-linux-musl-gcc || echo "aarch64-linux-musl-gcc not found" | |
echo "CC_aarch64-unknown-linux-musl=$(which aarch64-linux-musl-gcc)" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=$(which aarch64-linux-musl-gcc)" >> $GITHUB_ENV | |
echo "PATH=$(dirname $(which aarch64-linux-musl-gcc)):$PATH" >> $GITHUB_ENV | |
- name: Debug Info | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
echo "Checking installed packages..." | |
dpkg -l | grep -E 'musl-tools|musl-dev|gcc-aarch64-linux-gnu' | |
echo "Checking CC_aarch64-unknown-linux-musl..." | |
echo $CC_aarch64-unknown-linux-musl | |
echo "Checking CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER..." | |
echo $CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER | |
echo "PATH: $PATH" | |
- name: Install Cross-Compilation Tools for x86_64-linux-musl | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools musl-dev gcc-multilib | |
echo "CC_x86_64-unknown-linux-musl=musl-gcc" >> $GITHUB_ENV | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
# rustup target add aarch64-unknown-linux-musl | |
- name: Build wasm_cli | |
run: | | |
cd crates/wasm_cli | |
cargo build --release --target ${{ matrix.target }} | |
- name: Move built file | |
run: | | |
mv ./target/${{ matrix.target }}/release/versa-wasm ./target/${{ matrix.target }}/release/versa-wasm-${{ matrix.target }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
# if: startsWith(github.ref, 'refs/tags/') | |
with: | |
tag_name: "v1.0.0" | |
files: | | |
./target/${{ matrix.target }}/release/versa-wasm-${{ matrix.target }} | |
# - name: Create Release (runs only once) | |
# if: github.event.inputs.tag != 'edge' && matrix.target == 'x86_64-unknown-linux-musl' | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.event.inputs.tag }} | |
# release_name: Release ${{ github.event.inputs.tag }} | |
# draft: false | |
# prerelease: false | |
# - name: Upload Release Asset | |
# if: steps.create_release.outputs.upload_url | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./target/${{ matrix.target }}/release/versa-wasm | |
# asset_name: versa-wasm-${{ matrix.target }}.tar.gz | |
# asset_content_type: application/octet-stream | |
# run: | | |
# tar -czvf versa-wasm-${{ matrix.target }}.tar.gz -C ./target/${{ matrix.target }}/release versa-wasm |