Update rust.yml #117
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 Artifact Creation | |
on: | |
push: | |
branches: | |
- main | |
- win-build | |
pull_request: | |
branches: | |
- main | |
- win-build | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
toolchain: stable | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
toolchain: stable | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
toolchain: nightly | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
toolchain: nightly | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.toolchain }} | |
override: true | |
- name: Install target | |
run: rustup target add ${{ matrix.target }} | |
- name: Build project | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Find and Move Binary | |
run: | | |
binary_path=$(find target/${{ matrix.target }}/release -maxdepth 1 -type f -executable) | |
echo "Binary path: $binary_path" | |
mv $binary_path ${{ matrix.target }}-${{ matrix.toolchain }}-binary | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary | |
path: ${{ matrix.target }}-${{ matrix.toolchain }}-binary |