chore(main): Changed the CI.yml #1
Workflow file for this run
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: SRM-Benchmark CI | |
on: | |
push: | |
branches: [main] | |
tags: ['v*'] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-cpp: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
compiler: [g++, clang++, msvc] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up C++ build environment | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
run: sudo apt-get install -y libopencv-dev | |
- name: Build C++ project | |
run: | | |
mkdir build | |
cd build | |
cmake .. | |
make | |
- name: Test C++ executable | |
run: ./build/SRM-Benchmark ./imgs/Sample-Image.jpeg 32 15 0.001 | |
- name: Prepare C++ executable for release | |
if: success() | |
run: | | |
cp ./build/SRM-Benchmark ./SRM-Benchmark-${{ matrix.os }}-${{ matrix.compiler }} | |
build-python: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
cd ./libsrm_py | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Test Python project | |
run: | | |
python srm.py ./imgs/Sample-Image.jpeg 32 15 0.001 | |
- name: Prepare Python output for release | |
if: success() | |
run: | | |
cp ./libsrm_py/srm.py ./SRM-Benchmark-${{ matrix.os }}-python | |
build-rust: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions/setup-rust@v1 | |
- name: Build and test Rust project | |
run: | | |
cargo build --release | |
cargo run ./imgs/Sample-Image 32 15 0.001 | |
- name: Prepare Rust output for release | |
if: success() | |
run: | | |
cp ./target/release/SRM-Benchmark ./SRM-Benchmark-${{ matrix.os }}-rust | |
create-release: | |
needs: [build-cpp, build-python, build-rust] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create a release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v1.0.0 | |
release_name: "Release v1.0.0" | |
body: "This is the release of SRM-Benchmark executables for C++, Python, and Rust." | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload C++ executable | |
if: success() | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./SRM-Benchmark-ubuntu-latest-g++ | |
asset_name: SRM-Benchmark-ubuntu-latest-g++ | |
asset_content_type: application/octet-stream | |
- name: Upload Python executable | |
if: success() | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./SRM-Benchmark-ubuntu-latest-python | |
asset_name: SRM-Benchmark-ubuntu-latest-python | |
asset_content_type: application/octet-stream | |
- name: Upload Rust executable | |
if: success() | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./SRM-Benchmark-ubuntu-latest-rust | |
asset_name: SRM-Benchmark-ubuntu-latest-rust | |
asset_content_type: application/octet-stream |