Skip to content

Commit

Permalink
Create a cmake target for the commons library (#272)
Browse files Browse the repository at this point in the history
* Create a cmake target for the commons.

* Fix a broken test.

* Update workflows

* More workflow updates

* Add a windows cmake workflow

* More workflow updates.

* Double-dash

* Check folder

* Fix presets

* No /w

* Disable clang-tidy

* Update name.

* Try correcting directory.

* Build both targets.

* More path fixes.

* Even more path fixes.

* In both builds

* Add gcov and lcov targets

* Maybe don't change folders?

* Don't initially build gcov and lcov

* Use correct profile

* Just get the commands from vic3tohoi4

* Fix syntax error

* In both parts

* Borrow more from converter

* More tweaks

* Peek at directories.

* More folders

* Add some echos

* Moar folders

* Focus more

* Maybe these are the right dirs?

* Woah, we're halfway there!

* Maybe not the preceding folders?

* Correct path to coverage report

* Update exclusions.

* Don't get coverage of tests.

* Exclude nlohmann

* Fix path

* No need for gcov

* Remove another few gcov references

* One more workflow
  • Loading branch information
Idhrendur authored Dec 24, 2024
1 parent f5b02f2 commit 3d00ea8
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 167 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/linux_codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:

- name: Build solution
run: |
chmod u+x build_linux.sh
./build_linux.sh
cmake --preset x64-release-linux
cmake --build --preset build-x64-release-linux --target CommonItemsTests -- -j40
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down Expand Up @@ -72,9 +72,8 @@ jobs:
sudo apt-get install libgtest-dev
sudo ln -s /usr/bin/gcc-11 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-11 /usr/local/bin/g++
# Run your build commands next
chmod u+x ./build_linux_foreign.sh
bash ./build_linux_foreign.sh
cmake --preset x64-release-linux
cmake --build --preset build-x64-release-linux --target commonLib CommonItemsTests -- -j40
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
37 changes: 12 additions & 25 deletions .github/workflows/linux_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
analyze_main:
name: Analyze Local
name: Coverage Check Local
if: github.repository_owner == 'ParadoxGameConverters'
runs-on: [self-hosted, linux]

Expand All @@ -27,40 +27,34 @@ jobs:

- name: Build solution
run: |
cmake -H. -Bbuild && cmake --build ./build --target CommonItemsTests -- -j40
cmake --preset x64-coverage-linux
cmake --build --preset build-x64-coverage-linux --target CommonItemsTests -- -j40
- name: Run tests
run: |
cd build
cd build/x64-coverage-linux
./CommonItemsTests
- name: Run gcov
run: |
cd build
make gcov
- name: Run lcov
run: |
cd build
make lcov
run: cmake --build --preset build-x64-coverage-linux --target lcov

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: build/lcoverage/coverage.info
path-to-lcov: build/x64-coverage-linux/lcoverage/coverage.info

- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: build/lcoverage/
path: build/x64-coverage-linux/lcoverage/

- name: Cleanup
uses: colpal/actions-clean@v1
if: always()

analyze:
name: Analyze Foreign
name: Coverage Check Foreign
if: github.repository_owner != 'ParadoxGameConverters'
runs-on: ubuntu-latest

Expand All @@ -81,23 +75,16 @@ jobs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev lcov
cmake -H. -Bbuild && cmake --build ./build --target CommonItemsTests -- -j3
cmake --preset x64-coverage-linux
cmake --build --preset build-x64-coverage-linux --target commonLib CommonItemsTests -- -j40
- name: Run tests
run: |
cd build
cd build/x64-coverage-linux
./CommonItemsTests
- name: Run gcov
run: |
cd build
make gcov
- name: Run lcov
run: |
cd build
pwd
make lcov
run: cmake --build --preset build-x64-coverage-linux --target lcov

- name: Coveralls
uses: coverallsapp/github-action@master
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/windows_cmake_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Windows cmake build and test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_test:
name: Build and test local
if: github.repository_owner == 'ParadoxGameConverters'
runs-on: [self-hosted, windows]

steps:
- name: work around permission issue
run: git config --global --add safe.directory /github/workspace

- name: Add Ninja build to PATH
run: echo "c:\program files\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Build with cmake
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cmake --preset x64-release-windows
cmake --build --preset build-x64-release-windows --target commonLib CommonItemsTests -- -j40
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\x64-release-windows
.\CommonItemsTests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse
build_test:
name: Build and test foreign
if: github.repository_owner != 'ParadoxGameConverters'
runs-on: windows-2022

steps:
- name: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Install ninja
run: |
choco install ninja
- name: Build with cmake
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake --preset x64-release-windows
cmake --build --preset build-x64-release-windows --target commonLib -- -j40
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\x64-release-windows
.\CommonItemsTests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse
Loading

0 comments on commit 3d00ea8

Please sign in to comment.