120 lines
2.9 KiB
YAML
120 lines
2.9 KiB
YAML
name: Compile to Binary
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master, dev ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-unknown-linux-gnu
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: linux-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build Linux (glibc)
|
|
run: cargo build --release --target x86_64-unknown-linux-gnu
|
|
|
|
- name: Copy executable
|
|
run: |
|
|
mkdir -p artifacts
|
|
cp target/x86_64-unknown-linux-gnu/release/http-rs artifacts/http-rs-linux-x86_64
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: http-rs-linux-x86_64
|
|
path: artifacts/http-rs-linux-x86_64
|
|
|
|
|
|
build-linux-musl:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install musl tools
|
|
run: sudo apt-get update && sudo apt-get install -y musl-tools
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-unknown-linux-musl
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: musl-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build static binary
|
|
run: cargo build --release --target x86_64-unknown-linux-musl
|
|
|
|
- name: Copy executable
|
|
run: |
|
|
mkdir -p artifacts
|
|
cp target/x86_64-unknown-linux-musl/release/http-rs artifacts/http-rs-linux-musl-x86_64
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: http-rs-linux-musl-x86_64
|
|
path: artifacts/http-rs-linux-musl-x86_64
|
|
|
|
|
|
build-windows:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-pc-windows-gnu
|
|
|
|
- name: Install MinGW
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-mingw-w64-x86-64
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: windows-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build Windows
|
|
run: cargo build --release --target x86_64-pc-windows-gnu
|
|
|
|
- name: Copy executable
|
|
run: |
|
|
mkdir -p artifacts
|
|
cp target/x86_64-pc-windows-gnu/release/http-rs.exe artifacts/http-rs-windows-x86_64.exe
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: http-rs-windows-x86_64
|
|
path: artifacts/http-rs-windows-x86_64.exe
|