2023-08-04 13:28:41 +00:00
|
|
|
name: CI
|
2023-12-08 11:26:50 +00:00
|
|
|
|
2023-12-14 16:50:22 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-02-06 14:35:36 +00:00
|
|
|
branches: ["**"]
|
2023-12-14 16:50:22 +00:00
|
|
|
pull_request_target:
|
|
|
|
types: [labeled]
|
2023-08-04 13:28:41 +00:00
|
|
|
|
2023-12-08 11:26:50 +00:00
|
|
|
jobs:
|
2023-08-04 13:28:41 +00:00
|
|
|
lint_and_typecheck:
|
2024-01-08 08:38:55 +00:00
|
|
|
if: ${{ github.event_name == 'push' || github.event.label.name == 'run-ci' }}
|
2023-08-04 13:28:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-12-08 11:26:50 +00:00
|
|
|
|
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/**
|
2024-03-28 13:36:32 +00:00
|
|
|
- .github/workflows/ci.yml
|
2024-02-06 14:35:36 +00:00
|
|
|
|
2023-12-08 11:26:50 +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:
|
2023-12-08 11:26:50 +00:00
|
|
|
enable-cache: true
|
2024-02-06 14:35:36 +00:00
|
|
|
cache-prefix: "refiners-rye-cache"
|
2023-08-04 13:28:41 +00:00
|
|
|
|
2024-03-01 18:24:46 +00:00
|
|
|
- name: add Rye shims dir to PATH
|
2024-02-06 14:35:36 +00:00
|
|
|
if: steps.changes.outputs.sources == 'true'
|
2024-03-01 18:24:46 +00:00
|
|
|
run: echo "$RYE_HOME/shims" >> $GITHUB_PATH
|
2023-12-08 11:26:50 +00:00
|
|
|
|
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
|
|
|
|
|
2023-12-08 11:26:50 +00:00
|
|
|
- name: pin python
|
2024-02-06 14:35:36 +00:00
|
|
|
if: steps.changes.outputs.sources == 'true'
|
2023-12-08 11:26:50 +00:00
|
|
|
run: rye pin 3.10
|
2023-08-04 13:28:41 +00:00
|
|
|
|
2023-12-08 11:26:50 +00:00
|
|
|
- name: rye sync
|
2024-02-06 14:35:36 +00:00
|
|
|
if: steps.changes.outputs.sources == 'true'
|
2023-12-08 11:26:50 +00:00
|
|
|
run: rye sync --all-features
|
2023-08-04 13:28:41 +00:00
|
|
|
|
2024-03-05 18:12:42 +00:00
|
|
|
- name: rye fmt
|
2024-02-06 14:35:36 +00:00
|
|
|
if: steps.changes.outputs.sources == 'true'
|
2024-03-05 18:12:42 +00:00
|
|
|
run: rye fmt --check
|
2023-08-29 15:53:39 +00:00
|
|
|
|
2024-03-05 18:12:42 +00:00
|
|
|
- name: rye lint
|
2024-02-06 14:35:36 +00:00
|
|
|
if: steps.changes.outputs.sources == 'true'
|
2024-03-05 18:12:42 +00:00
|
|
|
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'
|
2023-12-08 11:26:50 +00:00
|
|
|
run: rye run pyright
|