-
Notifications
You must be signed in to change notification settings - Fork 5
GitHub Actions workflow for automated build and test #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Build and Test ldsCtrlEst | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up dependencies for macOS and Linux | ||
| if: runner.os != 'Windows' | ||
| run: | | ||
| if [ "${{ runner.os }}" == "macOS" ]; then | ||
| brew install cmake ninja | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this step could be covered by the get-cmake action, but it's not a big enough deal to change it now |
||
| elif [ "${{ runner.os }}" == "Linux" ]; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake build-essential | ||
| fi | ||
|
|
||
| - name: Set up dependencies for Windows | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| choco install cmake | ||
|
|
||
| - name: Run vcpkg | ||
| uses: lukka/run-vcpkg@v11 | ||
| with: | ||
| vcpkgJsonGlob: 'vcpkg.json' | ||
| runVcpkgInstall: true | ||
|
|
||
| - name: Cache build directory | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: build | ||
| key: build-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }} | ||
| restore-keys: | | ||
| build-${{ matrix.os }}- | ||
|
|
||
| - name: Configure and build for macOS/Linux | ||
| if: runner.os != 'Windows' | ||
| uses: lukka/run-cmake@v10 | ||
| with: | ||
| cmakeListsTxtPath: CMakeLists.txt | ||
| configurePreset: 'linux-release' | ||
| buildPreset: 'linux-release' | ||
|
|
||
| - name: Configure and build for Windows | ||
| if: runner.os == 'Windows' | ||
| uses: lukka/run-cmake@v10 | ||
| with: | ||
| cmakeListsTxtPath: CMakeLists.txt | ||
| configurePreset: 'windows-release' | ||
| buildPreset: 'windows-release' | ||
|
|
||
| - name: Install and Update PATH (Windows only) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| cd build | ||
| cmake --install . | ||
| echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| cd build | ||
| ctest -C Release | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "version": 3, | ||
| "cmakeMinimumRequired": { | ||
| "major": 3, | ||
| "minor": 18, | ||
| "patch": 0 | ||
| }, | ||
| "configurePresets": [ | ||
| { | ||
| "name": "linux-release", | ||
| "hidden": false, | ||
| "generator": "Unix Makefiles", | ||
| "binaryDir": "${sourceDir}/build", | ||
| "cacheVariables": { | ||
| "CMAKE_BUILD_TYPE": "Release", | ||
| "CMAKE_INSTALL_PREFIX": "${sourceDir}/install" | ||
| } | ||
| }, | ||
| { | ||
| "name": "windows-release", | ||
| "hidden": false, | ||
| "generator": "Visual Studio 17 2022", | ||
| "binaryDir": "${sourceDir}/build", | ||
| "cacheVariables": { | ||
| "CMAKE_BUILD_TYPE": "Release", | ||
| "CMAKE_INSTALL_PREFIX": "${sourceDir}/install" | ||
| } | ||
| } | ||
| ], | ||
| "buildPresets": [ | ||
| { | ||
| "name": "linux-release", | ||
| "configurePreset": "linux-release", | ||
| "hidden": false | ||
| }, | ||
| { | ||
| "name": "windows-release", | ||
| "configurePreset": "windows-release", | ||
| "hidden": false | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! The biggest question I have in my mind is what compilers are being used in the configure/build steps? One of the biggest headaches in getting the project to build right is that some compilers work and others don't for no apparent reason. Clang has worked most consistently across platforms, but not every version and not every machine we've tested...a mess. Assuming we will still have these problems, I think we will need to just choose a compiler, like Clang.
We may want to merge this now to get it working before adding more, but things we will want:
Then after getting the C++ build working:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project uses default compilers: GCC on Linux, Clang on macOS, and MSVC on Windows, which are working fine so far. It's possible to specify Clang as the compiler for all platforms, but I'm unsure if it's necessary since the compiler is automatically selected based on the platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great---if default compilers are working let's just run with those