Update Cargo.toml to reflect new monaos structure and add mona-types … #210
This file contains 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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
tags: "v*" | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
binary_name: kari | |
artifact_name: kari-linux-x64 | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc # Changed from gnu to msvc | |
binary_name: kari.exe | |
artifact_name: kari-windows-x64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
binary_name: kari | |
artifact_name: kari-macos-arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' # Add this to fetch submodules | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Linux dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
build-essential \ | |
cmake \ | |
gcc \ | |
libssl-dev \ | |
pkg-config \ | |
libclang-dev | |
- name: Install Windows dependencies | |
if: matrix.os == 'windows-latest' | |
run: | | |
choco install visualstudio2019buildtools | |
choco install visualstudio2019-workload-vctools | |
rustup default nightly-x86_64-pc-windows-msvc | |
- name: Setup Windows environment | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
$ReleasePath = "target\${{ matrix.target }}\release" | |
New-Item -ItemType Directory -Force -Path $ReleasePath | |
$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\14.29.30133\x64" | |
# Copy DLLs after build completes | |
if (Test-Path "C:\Windows\System32\vcruntime140.dll") { | |
Copy-Item "C:\Windows\System32\vcruntime140.dll" -Destination $ReleasePath | |
} | |
if (Test-Path "C:\Windows\System32\msvcp140.dll") { | |
Copy-Item "C:\Windows\System32\msvcp140.dll" -Destination $ReleasePath | |
} | |
- name: Install macOS dependencies | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install openssl@3 | |
brew install pkg-config | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: ${{ matrix.target }} | |
override: true | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} --verbose | |
env: | |
OPENSSL_DIR: /usr/local/opt/openssl@3 | |
# - name: Test | |
# run: cargo test --target ${{ matrix.target }} --verbose | |
# env: | |
# OPENSSL_DIR: /usr/local/opt/openssl@3 | |
- name: Debug binary location | |
if: matrix.os == 'windows-latest' | |
run: | | |
dir target\${{ matrix.target }}\release\ | |
shell: cmd | |
- name: Debug binary location | |
if: matrix.os != 'windows-latest' | |
run: ls -la target/${{ matrix.target }}/release/ | |
- name: Compress artifacts (Linux/MacOS) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
tar -czf ${{ matrix.artifact_name }}.tar.gz ${{ matrix.binary_name }} | |
- name: Compress artifacts (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
$ReleasePath = "target\${{ matrix.target }}\release" | |
Set-Location $ReleasePath | |
$Files = @() | |
if (Test-Path "${{ matrix.binary_name }}") { | |
$Files += "${{ matrix.binary_name }}" | |
} | |
if (Test-Path "vcruntime140.dll") { | |
$Files += "vcruntime140.dll" | |
} | |
if (Test-Path "msvcp140.dll") { | |
$Files += "msvcp140.dll" | |
} | |
Compress-Archive -Path $Files -DestinationPath ${{ matrix.artifact_name }}.zip -Force | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}.* | |
retention-days: 5 | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
pattern: kari-* | |
merge-multiple: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/kari-linux-x64.tar.gz | |
artifacts/kari-windows-x64.zip | |
artifacts/kari-macos-arm64.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |