Skip to content

C++ and Python Linting + Formatting + Format checks, including pre-commit and pre-push for GPU-code unit testing + CI #4

C++ and Python Linting + Formatting + Format checks, including pre-commit and pre-push for GPU-code unit testing + CI

C++ and Python Linting + Formatting + Format checks, including pre-commit and pre-push for GPU-code unit testing + CI #4

Workflow file for this run

name: Format and Lint
on:
push:
branches:
- '**' # Run on push to any branch
pull_request:
branches:
- main
- master
# Prevent duplicate runs when pushing to a branch with an open PR
# Groups PRs and their corresponding branch pushes together
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
jobs:
format-and-lint:
name: Format and Lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.9.0
with:
pixi-version: "latest"
cache: ${{ github.event_name == 'pull_request' }} # Only cache on PRs
- name: Cache pixi environment
if: github.event_name == 'pull_request'
uses: actions/cache@v4
with:
path: |
~/.pixi
.pixi
key: ${{ runner.os }}-pixi-${{ hashFiles('pixi.lock') }}
restore-keys: |
${{ runner.os }}-pixi-
- name: Install dependencies
run: pixi install
- name: Check formatting
run: pixi run format-check
- name: Lint code
run: pixi run lint