Skip to content

Commit

Permalink
test: compilation action
Browse files Browse the repository at this point in the history
  • Loading branch information
S0l4RIS9uk committed Sep 30, 2024
1 parent 3de683d commit 613f406
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/orch-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Rust
with:
# The working directory for each step
working-directory: ./orch-rs
on:
push:
branches: [ "v0-cli" ]
pull_request:
branches: [ "v0-cli" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
command: cargo
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
command: cargo
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
comand: cargo
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
command: cargo

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Install Cross
if: matrix.command == 'cross'
shell: bash
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cross
- name: Build Binary
run: ${{ matrix.command }} build --verbose --locked --release --target ${{ matrix.target }}

- name: Release Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"

# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"

# Move the built binary where you want it
mv "${BIN_OUTPUT}" "./releases/${BIN_RELEASE}"

0 comments on commit 613f406

Please sign in to comment.