Skip to content

Fixed Zenodo link redirect test fail #723

Fixed Zenodo link redirect test fail

Fixed Zenodo link redirect test fail #723

Workflow file for this run

name: pre-commit
on:
push:
workflow_dispatch:
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
clang-format-version: "v18.1.4"
cmake-format-version: "v0.6.13"
steps:
- name: Show git version
run: |
which git
git --version
- name: Check out a copy of the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Show some relevant env vars
run: |
echo "GITHUB_BASE_REF = $GITHUB_BASE_REF"
echo "GITHUB_HEAD_REF = $GITHUB_HEAD_REF"
echo "GITHUB_REF_NAME = $GITHUB_REF_NAME"
- name: Set the target and source refs if the trigger was a pull request
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "precommit_from_ref=$GITHUB_BASE_REF" >> $GITHUB_ENV
echo "precommit_to_ref=$GITHUB_HEAD_REF" >> $GITHUB_ENV
- name: Set the target and source refs if the trigger was not a pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "precommit_from_ref=main" >> $GITHUB_ENV
echo "precommit_to_ref=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Avoid problems with missing refs later
run: |
git checkout ${{ env.precommit_from_ref }}
git checkout ${{ env.precommit_to_ref }}
- name: Install cuda
uses: Jimver/cuda-toolkit@v0.2.11
with:
cuda: ${{ env.cuda-version }}
method: "network"
sub-packages: '["nvcc", "nvml-dev", "nvrtc-dev", "nvtx"]'
non-cuda-sub-packages: '["libcufft-dev"]'
linux-local-args: '["--toolkit"]'
- name: Install pre-commit and related tools
run: |
pip install pre-commit
pip install clang-format==${{env.clang-format-version}}
pip install cmake-format==${{env.cmake-format-version}}
sudo apt install cppcheck -y
- 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=g++-${{ env.gcc-version }} -DCUDAWRAPPERS_BUILD_TESTING=True -S . -B build
- name: Run pre-commit on all files changed in this branch using project standard configuration
shell: bash -el {0}
run: |
git diff --name-only ${{ env.precommit_from_ref }}...${{ env.precommit_to_ref }}
pre-commit run --from-ref ${{ env.precommit_from_ref }} --to-ref ${{ env.precommit_to_ref }}