Skip to content

Commit

Permalink
Suggestion: improve CI runtime (#199)
Browse files Browse the repository at this point in the history
* Remove conda from ci

* Install cuda with action; use CI runner compiler versions. TODO: ensure correct version of clang tools are used

* Fix cuda install action version

* Reduce size of cuda install as much as possible; set cuda version to 12.2

* Fix workflow syntax

* Add required cuda subpackages

* Move libcufft to other installer arg

* Install dev versions of nvrtc and cufft

* add cublas

* Install precommit in CI

* Temporarily force run all pre commit tools

* Install cppcheck, run verison check

* Don't let cppcheck complain about system includes it cannot find

* Print more tool versions

* Install cmake-{lint,format} in CI

* Make sure versions are the same in CI and env; properly install cmakelang

* Remove libcublas from CI; takes a while and seems like we don't actually need it

* make cppcheck stop complain about unmatched suppression unreadVariable

* Add tool names to version prints; revert to proper pre-commit run
  • Loading branch information
loostrum authored Sep 5, 2023
1 parent 7032e34 commit 114b45c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: pre-commit
# conda cache setup based on https://github.com/epassaro/cache-conda-envs

on:
push:
Expand All @@ -9,6 +8,15 @@ jobs:
linting:
name: run
runs-on: ubuntu-latest
env:
# set tools versions to latest supported by the CI runner,
# ubuntu 22.04 at the time of writing
# clang defaults to v14.0.0
gcc-version: "12" # = 12.1.0
# cuda version to install with separate action
cuda-version: "12.2.0"
# version for cmake-lint and cmake-format
cmakelang-version: "0.6.13"
steps:

- name: Show git version
Expand Down Expand Up @@ -44,27 +52,34 @@ jobs:
git checkout ${{ env.precommit_from_ref }}
git checkout ${{ env.precommit_to_ref }}
- name: Setup environment with Mamba
uses: conda-incubator/setup-miniconda@v2
- name: Install cuda
uses: Jimver/[email protected]
with:
mamba-version: "*"
channels: conda-forge
activate-environment: recruit
cuda: ${{ env.cuda-version }}
method: "network"
sub-packages: '["nvcc", "nvrtc-dev", "nvtx"]'
non-cuda-sub-packages: '["libcufft-dev"]'
linux-local-args: '["--toolkit"]'

- uses: actions/cache@v2
with:
path: /usr/share/miniconda/envs/recruit
key: conda-${{ hashFiles('environment.yml') }}
id: cache
- name: Install pre-commit and related tools
run: |
pip install pre-commit cmakelang==${{ env.cmakelang-version}}
sudo apt install cppcheck -y
- name: Update mamba environment if cache is outdated
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n recruit -f environment.yml
- name: Show tool versions
run: |
echo "nvcc: $(nvcc --version)"
echo "g++: $(g++-${{ env.gcc-version}} --version)"
echo "clang-format: $(clang-format --version)"
echo "clang-tidy: $(clang-tidy --version)"
echo "cppcheck: $(cppcheck --version)"
echo "cmake-lint: $(cmake-lint --version)"
echo "cmake-format: $(cmake-format --version)"
- name: Generate compilation database
shell: bash -el {0}
run: |
cmake -DCMAKE_CXX_COMPILER=clang++ -DCUDAWRAPPERS_BUILD_TESTING=True -DCUDAWRAPPERS_BUILD_EXAMPLES=True -S . -B build
cmake -DCMAKE_CXX_COMPILER=g++-${{ env.gcc-version }} -DCUDAWRAPPERS_BUILD_TESTING=True -DCUDAWRAPPERS_BUILD_EXAMPLES=True -S . -B build
- name: Run pre-commit on all files changed in this branch using project standard configuration
shell: bash -el {0}
Expand Down
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v14.0.0
hooks:
- id: clang-format
- repo: https://github.com/pocc/pre-commit-hooks
Expand All @@ -12,6 +12,8 @@ repos:
- '--suppress=*:build/*'
- '--suppress=unusedFunction:*/*'
- '--suppress=unreadVariable:tests/*'
- '--suppress=missingIncludeSystem'
- '--suppress=unmatchedSuppression'
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
Expand Down
10 changes: 5 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ channels:
- conda-forge
dependencies:
- c-compiler
- clang==16.0.6
- clang-tools==16.0.6
- clang==14.0.0
- clang-tools==14.0.0
- cmake>=3.17
- cppcheck==2.10.3
- cudatoolkit-dev>=10.0
- cppcheck==2.7.5
- cudatoolkit-dev==12.2.0
- cxx-compiler
- doxygen
- gcovr
Expand All @@ -19,6 +19,6 @@ dependencies:
- pip:
- pre-commit
- bump2version==1.0.1
- clang-format==16.0.6
- clang-format==14.0.0
- cmakelang==0.6.13
- flawfinder==2.0.19

0 comments on commit 114b45c

Please sign in to comment.