Skip to content

arm <3 #5

arm <3 #5 #5

Workflow file for this run

name: Build Rust Project
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: mc-oauth
asset_name: mc-oauth-linux-amd64
- os: windows-latest
target: x86_64-pc-windows-gnu
artifact_name: mc-oauth.exe
asset_name: mc-oauth-windows-amd64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: mc-oauth
asset_name: mc-oauth-macos-amd64
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Install OpenSSL (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
sudo echo "OPENSSL_DIR=$(openssl version -d | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Install OpenSSL (macOS)
if: runner.os == 'macOS'
run: brew install openssl
- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
run: vcpkg install openssl:x64-windows
- name: Install Linux ARM dependencies
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Set linker for Linux ARM
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust"
shared-key: "${{ matrix.target }}"
cache-on-failure: "true"
cache-all-crates: "true"
workspaces: |
. -> target
cache-targets: "true"
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}