Skip to content

Remove first empty line #303

Remove first empty line

Remove first empty line #303

Workflow file for this run

name: pre-commit
# conda cache setup based on https://github.com/epassaro/cache-conda-envs
on:
push:
workflow_dispatch:
jobs:
linting:
name: run
runs-on: ubuntu-latest
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: Setup environment with Mamba
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge
activate-environment: recruit
- uses: actions/cache@v2
with:
path: /usr/share/miniconda/envs/recruit
key: conda-${{ hashFiles('environment.yml') }}
id: cache
- 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: Generate compilation database
shell: bash -el {0}
run: |
cmake -DCMAKE_CXX_COMPILER=clang++ -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}
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 }}