Skip to content

Commit 7134c40

Browse files
committed
reusable workflows
1 parent 93e8ef9 commit 7134c40

3 files changed

Lines changed: 16 additions & 59 deletions

File tree

.github/workflows/pre-commit-main.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: pre-commit-main
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
67

78
concurrency:
89
group: ${{ github.workflow }}-${{ github.ref }}
@@ -12,22 +13,7 @@ jobs:
1213
pre-commit:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v4
16+
- uses: Komorebi-AI/github-actions/.github/workflows/pre-commit-uv.yml@main
1617
with:
17-
# required to grab the history of the PR
18-
fetch-depth: 0
19-
# Not needed since uv installs python automatically
20-
# - uses: actions/setup-python@v5
21-
# with:
22-
# python-version-file: ".python-version"
23-
- name: Set up uv
24-
run: curl -LsSf https://astral.sh/uv/0.4.3/install.sh | sh
25-
# Needed for mypy, since the pre-commit hook is run in "system" mode
26-
- name: Install dependencies
27-
run: |
28-
uv sync --dev --frozen
29-
# Workaround to allow pre-commit to find the venv where dependencies are installed
30-
- run: |
31-
echo "$PWD/.venv/bin" >> $GITHUB_PATH
32-
uv pip install pip
33-
- uses: pre-commit/action@v3.0.1
18+
uv-version: 0.4.3
19+
secrets: inherit

.github/workflows/pre-commit-pr.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,18 @@ name: pre-commit-pr
22

33
on:
44
pull_request:
5+
workflow_dispatch:
56

67
concurrency:
78
group: ${{ github.workflow }}-${{ github.ref }}
89
cancel-in-progress: true
910

1011
jobs:
11-
pre-commit:
12+
pre-commit-changes:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v4
15+
- uses: Komorebi-AI/github-actions/.github/workflows/pre-commit-uv.yml@main
1516
with:
16-
# required to grab the history of the PR
17-
fetch-depth: 0
18-
# Not needed since uv installs python automatically
19-
# - uses: actions/setup-python@v5
20-
# with:
21-
# python-version-file: ".python-version"
22-
- name: Set up uv
23-
run: curl -LsSf https://astral.sh/uv/0.4.3/install.sh | sh
24-
# Needed for mypy, since the pre-commit hook is run in "system" mode
25-
- name: Install dependencies
26-
run: uv sync --dev --frozen
27-
# Workaround to allow pre-commit to find the venv where dependencies are installed
28-
- run: |
29-
echo "$PWD/.venv/bin" >> $GITHUB_PATH
30-
uv pip install pip
31-
- uses: pre-commit/action@v3.0.1
32-
with:
33-
# Ejecutar solo en ficheros que hayan cambiado https://github.com/pre-commit/action/issues/7
34-
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
17+
uv-version: 0.4.3
18+
pre-commit-args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
19+
secrets: inherit

.github/workflows/pytest.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,21 @@
1-
name: Pytest
1+
name: pytest
22

3-
# Controls when the action will run.
43
on:
5-
# Triggers the workflow on push or pull request events but only for the main branch
64
push:
75
branches: [main]
86
pull_request:
97
branches: [main]
10-
11-
# Allows you to run this workflow manually from the Actions tab
128
workflow_dispatch:
139

1410
concurrency:
1511
group: ${{ github.workflow }}-${{ github.ref }}
1612
cancel-in-progress: true
1713

1814
jobs:
19-
default-shell:
20-
name: Default shell
21-
runs-on: "ubuntu-latest"
22-
strategy:
23-
matrix:
24-
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
pytest:
16+
runs-on: ubuntu-latest
2517
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-python@v5
18+
- uses: Komorebi-AI/github-actions/.github/workflows/pytest-uv.yml@main
2819
with:
29-
python-version: ${{ matrix.python-version }}
30-
- name: Set up uv
31-
run: curl -LsSf https://astral.sh/uv/0.4.3/install.sh | sh
32-
- name: Test with pytest
33-
run: |
34-
uv sync --dev --frozen
35-
uv run pytest
20+
uv-version: 0.4.3
21+
secrets: inherit

0 commit comments

Comments
 (0)