diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 00000000..d228877a --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -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* diff --git a/cmake/vcpkg_linux.diff b/cmake/vcpkg_linux.diff new file mode 100644 index 00000000..dd4475bc --- /dev/null +++ b/cmake/vcpkg_linux.diff @@ -0,0 +1,6 @@ +stb +pthreads +ffmpeg +opencv[ffmpeg] +--triplet +x64-linux \ No newline at end of file diff --git a/cmake/vcpkg_osx.diff b/cmake/vcpkg_osx.diff new file mode 100644 index 00000000..12d2dfe4 --- /dev/null +++ b/cmake/vcpkg_osx.diff @@ -0,0 +1,6 @@ +stb +pthreads +ffmpeg +opencv[ffmpeg] +--triplet +x64-osx \ No newline at end of file diff --git a/cmake/vcpkg_windows.diff b/cmake/vcpkg_windows.diff new file mode 100644 index 00000000..ff554a81 --- /dev/null +++ b/cmake/vcpkg_windows.diff @@ -0,0 +1,6 @@ +stb +pthreads +ffmpeg +opencv[ffmpeg] +--triplet +x64-windows \ No newline at end of file