refiners/.github/workflows/ci.yml

63 lines
1.5 KiB
YAML
Raw Normal View History

2023-08-04 13:28:41 +00:00
name: CI
on:
push:
2024-02-06 14:35:36 +00:00
branches: ["**"]
pull_request_target:
types: [labeled]
2023-08-04 13:28:41 +00:00
jobs:
2023-08-04 13:28:41 +00:00
lint_and_typecheck:
if: ${{ github.event_name == 'push' || github.event.label.name == 'run-ci' }}
2023-08-04 13:28:41 +00:00
runs-on: ubuntu-latest
2023-08-04 13:28:41 +00:00
steps:
- name: checkout
2023-09-04 13:41:31 +00:00
uses: actions/checkout@v4
2023-08-04 13:28:41 +00:00
2024-02-06 14:35:36 +00:00
- name: check changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
sources:
- src/**
- tests/**
- scripts/**
- .github/workflows/ci.yml
2024-02-06 14:35:36 +00:00
- name: Install Rye
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
2024-06-27 10:11:52 +00:00
uses: eifinger/setup-rye@v3
2023-08-04 13:28:41 +00:00
with:
enable-cache: true
2024-02-06 14:35:36 +00:00
cache-prefix: "refiners-rye-cache"
2023-08-04 13:28:41 +00:00
- name: add Rye shims dir to PATH
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: echo "$RYE_HOME/shims" >> $GITHUB_PATH
2024-03-28 13:33:10 +00:00
- name: use uv
if: steps.changes.outputs.sources == 'true'
run: rye config --set-bool behavior.use-uv=true
- name: pin python
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: rye pin 3.10
2023-08-04 13:28:41 +00:00
- name: rye sync
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: rye sync --all-features
2023-08-04 13:28:41 +00:00
- name: rye fmt
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: rye fmt --check
2023-08-29 15:53:39 +00:00
- name: rye lint
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: rye lint
2023-08-04 13:28:41 +00:00
- name: typecheck
2024-02-06 14:35:36 +00:00
if: steps.changes.outputs.sources == 'true'
run: rye run pyright