Skip to content

Commit

Permalink
add GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
cenit committed Apr 30, 2020
1 parent a3f6c2b commit 234218b
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 0 deletions.
250 changes: 250 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions cmake/vcpkg_linux.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-linux
6 changes: 6 additions & 0 deletions cmake/vcpkg_osx.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-osx
6 changes: 6 additions & 0 deletions cmake/vcpkg_windows.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
stb
pthreads
ffmpeg
opencv[ffmpeg]
--triplet
x64-windows

0 comments on commit 234218b

Please sign in to comment.