add GitHub Actions

This commit is contained in:
Stefano Sinigardi 2020-04-30 15:32:50 +02:00
parent a3f6c2b58e
commit 234218b961
4 changed files with 268 additions and 0 deletions

250
.github/workflows/ccpp.yml vendored Normal file
View File

@ -0,0 +1,250 @@
name: Darknet Continuous Integration
on: [push, pull_request]
jobs:
linux-build-vcpkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Install system dependencies
- name: Update apt
run: sudo apt update
- name: Install dependencies
run: sudo apt install libopencv-dev yasm
# Install latest CMake.
- uses: lukka/get-cmake@latest
# Restore from cache the previously built ports. If "cache miss", then provision vcpkg, install desired ports, finally cache everything for the next run.
- name: Restore from cache and run vcpkg
env:
vcpkgResponseFile: ${{ github.workspace }}/cmake/vcpkg_linux.diff
uses: lukka/run-vcpkg@v2
with:
# Response file stored in source control, it provides the list of ports and triplet(s).
vcpkgArguments: '@${{ env.vcpkgResponseFile }}'
# Location of the vcpkg as submodule of the repository.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '2bc6cd714f931c32d3299a137d5abe0f86f803e1'
# Since the cache must be invalidated when content of the response file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }}
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/buildDirectory'
cmakeBuildType: 'Release'
cmakeAppendedArgs: "-DBUILD_SHARED_LIBS=OFF"
buildWithCMakeArgs: '--target install'
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: cfg
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: data
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/*dark*
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/uselib*
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Install system dependencies
- name: Update apt
run: sudo apt update
- name: Install dependencies
run: sudo apt install libopencv-dev yasm
# Install latest CMake.
- uses: lukka/get-cmake@latest
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/buildDirectory'
cmakeBuildType: 'Release'
buildWithCMakeArgs: '--target install'
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: cfg
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: data
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: ${{ github.workspace }}/*dark*
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: ${{ github.workspace }}/uselib*
macos-build-vcpkg:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
# Install system dependencies
- name: Install dependencies
run: brew install opencv libomp yasm
# Install latest CMake.
- uses: lukka/get-cmake@latest
# Restore from cache the previously built ports. If "cache miss", then provision vcpkg, install desired ports, finally cache everything for the next run.
- name: Restore from cache and run vcpkg
env:
vcpkgResponseFile: ${{ github.workspace }}/cmake/vcpkg_osx.diff
uses: lukka/run-vcpkg@v2
with:
# Response file stored in source control, it provides the list of ports and triplet(s).
vcpkgArguments: '@${{ env.vcpkgResponseFile }}'
# Location of the vcpkg as submodule of the repository.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '2bc6cd714f931c32d3299a137d5abe0f86f803e1'
# Since the cache must be invalidated when content of the response file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }}
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/buildDirectory'
cmakeBuildType: 'Release'
cmakeAppendedArgs: "-DBUILD_SHARED_LIBS=OFF"
buildWithCMakeArgs: '--target install'
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: cfg
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: data
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/*dark*
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/uselib*
macos-build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
# Install system dependencies
- name: Install dependencies
run: brew install opencv libomp yasm
# Install latest CMake.
- uses: lukka/get-cmake@latest
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/buildDirectory'
cmakeBuildType: 'Release'
buildWithCMakeArgs: '--target install'
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: cfg
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: data
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: ${{ github.workspace }}/*dark*
- uses: actions/upload-artifact@v2
with:
name: darknet-${{ runner.os }}
path: ${{ github.workspace }}/uselib*
windows-build-vcpkg:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
# Install latest CMake.
- uses: lukka/get-cmake@latest
# Restore from cache the previously built ports. If "cache miss", then provision vcpkg, install desired ports, finally cache everything for the next run.
- name: Restore from cache and run vcpkg
env:
vcpkgResponseFile: ${{ github.workspace }}/cmake/vcpkg_windows.diff
uses: lukka/run-vcpkg@v2
with:
# Response file stored in source control, it provides the list of ports and triplet(s).
vcpkgArguments: '@${{ env.vcpkgResponseFile }}'
# Location of the vcpkg as submodule of the repository.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '2bc6cd714f931c32d3299a137d5abe0f86f803e1'
# Since the cache must be invalidated when content of the response file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }}
- name: 'Build with CMake and Ninja'
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/buildDirectory'
cmakeBuildType: 'Release'
buildWithCMakeArgs: '--target install'
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: cfg
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: data
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/*dark*
- uses: actions/upload-artifact@v2
with:
name: darknet-vcpkg-${{ runner.os }}
path: ${{ github.workspace }}/uselib*

6
cmake/vcpkg_linux.diff Normal file
View File

@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-linux

6
cmake/vcpkg_osx.diff Normal file
View File

@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-osx

6
cmake/vcpkg_windows.diff Normal file
View File

@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-windows