не ну а че #4 #4
This file contains hidden or 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 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: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
artifact_name: mc-oauth | |
asset_name: mc-oauth-linux-arm | |
- os: windows-latest | |
target: x86_64-pc-windows-gnu | |
artifact_name: mc-oauth.exe | |
asset_name: mc-oauth-windows-amd64.exe | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
artifact_name: mc-oauth.exe | |
asset_name: mc-oauth-windows-arm.exe | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: mc-oauth | |
asset_name: mc-oauth-macos-amd64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: mc-oauth | |
asset_name: mc-oauth-macos-arm | |
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 | |
echo "OPENSSL_DIR=$(vcpkg list | grep openssl | cut -d' ' -f1)" >> $GITHUB_ENV | |
- name: Install Linux ARM dependencies | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo dpkg --add-architecture arm64 | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ | |
libssl-dev:arm64 pkg-config | |
echo "OPENSSL_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV | |
- 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 }} |