-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (115 loc) · 3.81 KB
/
srm-benchmark-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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