testing compile workflow for convinience
All checks were successful
Compile to Binary / build-linux (push) Successful in 1m38s
Compile to Binary / build-windows (push) Successful in 1m24s

This commit is contained in:
2026-03-16 06:58:08 +01:00
parent 2b62b9c272
commit 39bf977604

View File

@@ -0,0 +1,89 @@
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:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: https://github.com/dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build for Linux
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Copy Linux executable
run: |
mkdir -p artifacts
cp target/x86_64-unknown-linux-gnu/release/http-rs artifacts/http-rs-linux-x86_64
- name: Upload Linux artifact
uses: actions/upload-artifact@v3
with:
name: http-rs-linux-x86_64
path: artifacts/http-rs-linux-x86_64
if-no-files-found: error
build-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: https://github.com/dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-pc-windows-gnu
- name: Install MinGW cross-compiler
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-windows-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-windows-
- name: Build for Windows
run: cargo build --release --target x86_64-pc-windows-gnu
- name: Copy Windows executable
run: |
mkdir -p artifacts
cp target/x86_64-pc-windows-gnu/release/http-rs.exe artifacts/http-rs-windows-x86_64.exe
- name: Upload Windows artifact
uses: actions/upload-artifact@v3
with:
name: http-rs-windows-x86_64
path: artifacts/http-rs-windows-x86_64.exe
if-no-files-found: error