Skip to content

Commit

Permalink
Merge pull request #2 from whyb/test-ci
Browse files Browse the repository at this point in the history
Add github build ci and release ci
  • Loading branch information
whyb authored Jan 20, 2025
2 parents 64c06b1 + bc888f9 commit dec7ec8
Show file tree
Hide file tree
Showing 2 changed files with 240 additions and 12 deletions.
71 changes: 59 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ on:
- test-ci

jobs:
build-linux:
build-linux-x64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodule_update: ON
run_tests: ON
unit_test_build: -Dtest=ON
- name: Check out the repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand All @@ -40,11 +36,11 @@ jobs:
run: build/example-opencv


build-windows:
build-windows-x64:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
Expand All @@ -53,8 +49,8 @@ jobs:

- name: Install dependencies
run: |
choco install cmake --version=3.31.3
choco install opencv --version=4.10.0
choco install cmake --force
choco install opencv --version=4.10.0 --force
- name: CMake Configure & Generate
run: cmake -S . -B build -DBUILD_EXAMPLE:BOOL="1" -DBUILD_EXAMPLE_OPENCV:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -DOpenCV_DIR:PATH="C:\tools\opencv\build"
Expand All @@ -72,3 +68,54 @@ jobs:
run: |
copy C:\tools\opencv\build\x64\vc16\bin\opencv_world4100.dll build\Release\
build\Release\example-opencv.exe
build-windows-x86:
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
with:
arch: amd64_x86

- name: Install dependencies
run: |
choco install cmake --force
- name: CMake Configure & Generate
run: cmake -S . -B build -DBUILD_EXAMPLE:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -A Win32

- name: Build
run: cmake --build build --config Release

- name: Run example tests
run: build\Release\example.exe

- name: Run benchmark tests
run: build\Release\benchmark.exe


build-windows-arm64:
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
with:
arch: amd64_arm64

- name: Install dependencies
run: |
choco install cmake --force
- name: CMake Configure & Generate
run: cmake -S . -B build -DBUILD_EXAMPLE:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -A ARM64

- name: Build
run: cmake --build build --config Release

181 changes: 181 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: Release CI

on:
push:
tags:
- "v*.*.*"
branches:
- main
- test-ci

permissions:
contents: write
discussions: write

jobs:
build-linux-x64:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake
sudo apt-get install -y libomp-dev
sudo apt-get install -y libopencv-dev
- name: CMake Configure & Generate(x64)
run: cmake -S . -B build-x64 -DBUILD_EXAMPLE:BOOL="1" -DBUILD_EXAMPLE_OPENCV:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1"

- name: Build(x64)
run: cmake --build build-x64 --config Release

- name: List build folder
run: ls ./build-x64/

- name: Zip binary files
run: zip ./bin-linux-gcc-x64.zip ./build-x64/example ./build-x64/benchmark ./build-x64/example-opencv

- name: Archive Linux build artifacts
uses: actions/upload-artifact@v4
with:
name: linux-x64-artifacts
path: ./bin-linux-gcc-x64.zip

build-windows-x64:
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
with:
arch: x64

- name: Install dependencies
run: |
choco install cmake --force
choco install opencv --version=4.10.0 --force
choco install zip --force
- name: CMake Configure & Generate(x64)
run: cmake -S . -B build-x64 -DBUILD_EXAMPLE:BOOL="1" -DBUILD_EXAMPLE_OPENCV:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -DOpenCV_DIR:PATH="C:\tools\opencv\build" -A x64

- name: Build(x64)
run: cmake --build build-x64 --config Release

- name: List build folder
run: |
dir .\build-x64\
dir .\build-x64\Release\
- name: Zip binary files
run: |
zip ./bin-windows-msvc-x64.zip .\build-x64\Release\example.exe .\build-x64\Release\benchmark.exe .\build-x64\Release\example-opencv.exe
- name: Archive Windows build artifacts
uses: actions/upload-artifact@v4
with:
name: windows-x64-artifacts
path: |
./bin-windows-msvc-x64.zip
build-windows-x86:
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
with:
arch: amd64_x86

- name: Install dependencies
run: |
choco install cmake --force
choco install zip --force
- name: CMake Configure & Generate(x86)
run: cmake -S . -B build-x86 -DBUILD_EXAMPLE:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -A Win32

- name: Build(x86)
run: cmake --build build-x86 --config Release

- name: List build folder
run: |
dir .\build-x86\
dir .\build-x86\Release\
- name: Zip binary files
run: |
zip ./bin-windows-msvc-x86.zip .\build-x86\Release\example.exe .\build-x86\Release\benchmark.exe
- name: Archive Windows build artifacts
uses: actions/upload-artifact@v4
with:
name: windows-x86-artifacts
path: |
./bin-windows-msvc-x86.zip
build-windows-arm64:
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/[email protected]
with:
arch: amd64_arm64

- name: Install dependencies
run: |
choco install cmake --force
choco install zip --force
- name: CMake Configure & Generate(arm64)
run: cmake -S . -B build-arm64 -DBUILD_EXAMPLE:BOOL="1" -DBUILD_BENCHMARK:BOOL="1" -DUSE_OPENMP:BOOL="1" -A ARM64

- name: Build(arm64)
run: cmake --build build-arm64 --config Release

- name: List build folder
run: |
dir .\build-arm64\
dir .\build-arm64\Release\
- name: Zip binary files
run: |
zip ./bin-windows-msvc-arm64.zip .\build-arm64\Release\example.exe .\build-arm64\Release\benchmark.exe
- name: Archive Windows build artifacts
uses: actions/upload-artifact@v4
with:
name: windows-arm64-artifacts
path: |
./bin-windows-msvc-arm64.zip
release:
needs: [build-linux-x64, build-windows-x64, build-windows-x86, build-windows-arm64]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./releasefiles
merge-multiple: true

- name: Display structure of downloaded files
run: ls -R ./releasefiles

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
./releasefiles/*

0 comments on commit dec7ec8

Please sign in to comment.