-
Notifications
You must be signed in to change notification settings - Fork 6
54 lines (49 loc) · 1.73 KB
/
ci-code-style.yml
File metadata and controls
54 lines (49 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: CI Code Style
on:
pull_request:
branches: main
push:
branches: main
workflow_dispatch:
# Limit concurrently running workflow for a specific pull request.
# Cancel and resubmit if a new push is made. See GitHub docs:
# https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-style:
name: Run code style checks
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.lock
environment-name: ci-env
cache-environment: true
- name: Run black
id: black
run: black --check .
shell: micromamba-shell {0}
continue-on-error: true
- name: Run ruff
id: ruff
run: ruff check .
shell: micromamba-shell {0}
continue-on-error: true
- name: Collect failures
if: |
steps.black.outcome == 'failure' ||
steps.ruff.outcome == 'failure'
env:
BLACK_OUTCOME: ${{ steps.black.outcome }}
RUFF_OUTCOME: ${{ steps.ruff.outcome }}
run: |
echo "One or more code style checks failed:"
echo "black: $BLACK_OUTCOME"
echo "ruff: $RUFF_OUTCOME"
echo "See the logs for the failed checks for more details"
exit 1