Skip to content

[poc_linux_compile] Test parallelism 3 #23

[poc_linux_compile] Test parallelism 3

[poc_linux_compile] Test parallelism 3 #23

name: Rust Build on Windows
#3
on:
push:
branches:
- cicd-test
workflow_dispatch:
jobs:
poc_windows_x86_64_compile:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# - name: Cache cargo
# uses: actions/cache@v4
# with:
# path: ~/.cargo
# key: ${{ runner.arch }}-${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.arch }}-${{ runner.os }}-cargo-cache-
- name: Download rustup-init
run: curl.exe --output rustup-init.exe --url https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
- name: Run rustup-init
run: ./rustup-init.exe -vy
- name: Install Rust Toolchain
run: |
$env:PATH = "$env:USERPROFILE\.cargo\bin;" + $env:PATH
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH
rustup toolchain install stable-x86_64-pc-windows-msvc
rustup default stable-x86_64-pc-windows-msvc
- name: Get rust version
shell: pwsh
run: rustc --version
- name: Install MinGW and NSIS with Chocolatey
run: choco install -y mingw nsis
- name: Install Rust Quality Tools
run: |
rustup component add clippy
rustup component add rustfmt
cargo install cargo-audit
- name: Cargo Check
run: cargo check
- name: Cargo Clippy
run: cargo clippy -- -D warnings
- name: Cargo Format Check
run: cargo fmt -- --check
- name: Cargo Audit
run: cargo audit
- name: Cargo Build
run: cargo build --release
- name: Cargo Test
run: cargo test --release
# - name: Clean cargo cache
# run: |
# cargo install cargo-cache
# cargo-cache -a clean-unref
poc_windows_arm_64_compile:
runs-on: windows-11-arm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download VS Build Tools
run: curl.exe -SL --output vs_buildtools.exe --url https://aka.ms/vs/17/release/vs_buildtools.exe
- name: Install VS Components
run: .\vs_buildtools.exe --add Microsoft.VisualStudio.Component.Clang --add Microsoft.VisualStudio.Component.VC.tools.arm64 --wait --includeRecommended --quiet --norestart
shell: powershell
- name: Download Rustup-init
run: curl.exe --output rustup-init.exe --url https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
- name: Install Rustup
run: .\rustup-init.exe -vy
- name: Install Rust Toolchain
run: Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\rustup" toolchain install stable-aarch64-pc-windows-msvc'
shell: powershell
- name: Set Default Rust Toolchain
run: Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\rustup" default stable-aarch64-pc-windows-msvc'
shell: powershell
- name: Install Quality Tools
run: |
$env:PATH = "$env:USERPROFILE\.cargo\bin;" + $env:PATH
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH
rustup component add clippy
rustup component add rustfmt
cargo install cargo-audit
shell: powershell
- name: Run Cargo Checks
run: |
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH;
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" check'
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" clippy -- -D warnings'
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" fmt -- --check'
shell: powershell
- name: Run Cargo Audit
run: |
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH;
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" audit'
- name: Reset Git Config
run: git config --global url.ssh://[email protected] https://github.com/
- name: Cargo Build
run: |
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH;
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" build --release'
shell: powershell
- name: Cargo Test
run: |
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH;
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" test --release'
shell: powershell
poc_linux_compile:
strategy:
matrix:
runner-type: [ ubuntu-24.04, ubuntu-24.04-arm ]
runs-on: ${{ matrix.runner-type }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update APT and Install Dependencies
run: |
sudo apt-get update
sudo apt-get -y install curl musl-tools
- name: Install Rust with rustup
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Add ARM Target
if: matrix.runner-type == 'ubuntu-24.04-arm'
run: . "$HOME/.cargo/env"; rustup target add aarch64-unknown-linux-musl
- name: Add x86 Target
if: matrix.runner-type == 'ubuntu-24.04'
run: . "$HOME/.cargo/env"; rustup target add x86_64-unknown-linux-musl
- name: Install Quality Tools
run: |
. "$HOME/.cargo/env"
rustup component add clippy
rustup component add rustfmt
cargo install cargo-audit
- name: Run Cargo Checks
run: |
. "$HOME/.cargo/env"
cargo check
cargo clippy -- -D warnings
cargo fmt -- --check
cargo audit
- name: Cargo build ARM Target
if: matrix.runner-type == 'ubuntu-24.04-arm'
run: . "$HOME/.cargo/env"; cargo build --target=aarch64-unknown-linux-musl --release
- name: Cargo build x86 Target
if: matrix.runner-type == 'ubuntu-24.04'
run: . "$HOME/.cargo/env"; cargo build --target=x86_64-unknown-linux-musl --release
- name: Cargo test
run: . "$HOME/.cargo/env"; cargo test --release
- name: Strip Binary ARM Target
if: matrix.runner-type == 'ubuntu-24.04-arm'
run: strip ./target/aarch64-unknown-linux-musl/release/openbas-agent
- name: Strip Binary x86 Target
if: matrix.runner-type == 'ubuntu-24.04'
run: strip ./target/x86_64-unknown-linux-musl/release/openbas-agent
poc_macos_matrix_compile:
name: poc_macos_compile
strategy:
matrix:
runner-type: [macos-15, macos-13]
runs-on: ${{ matrix.runner-type }}
steps:
- name: Print system information
run: |
echo Hostname: $(hostname)
echo Number of CPUs: $(sysctl -n hw.ncpu)
echo Architecture: $(uname -m)
echo RAM: $(system_profiler SPHardwareDataType | grep "Memory")
echo OS Version: $(sw_vers -productVersion)
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust with rustup
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Install Quality Tools
run: |
. "$HOME/.cargo/env"
rustup component add clippy
rustup component add rustfmt
cargo install cargo-audit
- name: Run Cargo Checks
run: |
. "$HOME/.cargo/env"
cargo check
cargo clippy -- -D warnings
cargo fmt -- --check
cargo audit
- name: Build ARM Target
run: . "$HOME/.cargo/env"; cargo build --release
- name: Test ARM Target
run: . "$HOME/.cargo/env"; cargo test --release
- name: Strip Binary
run: strip ./target/release/openbas-agent