Skip to content

Commit ba6e461

Browse files
authored
Merge pull request #2 from bright2227/bright2227-chore-ci-workflow
chore: add ci workflow
2 parents e2f9985 + 7651b47 commit ba6e461

File tree

3 files changed

+110
-21
lines changed

3 files changed

+110
-21
lines changed

.github/actions/prepare/action.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: "Prepare Build Environment"
2+
description: "Checkout, cache, build liburing, and install Python deps"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Checkout repo
7+
uses: actions/checkout@v4
8+
with:
9+
submodules: recursive
10+
fetch-depth: 0
11+
12+
- name: Get system info and liburing commit hash
13+
id: cache-info
14+
shell: bash
15+
run: |
16+
echo "sysinfo=$(uname -a | md5sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
17+
echo "liburing_hash=$(cd libs && git rev-parse HEAD)" >> $GITHUB_OUTPUT
18+
19+
- name: Cache Python dependencies
20+
id: cache-python
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
.venv
25+
~/.cache/uv
26+
key: ${{ runner.os }}-py-${{ hashFiles('uv.lock') }}
27+
28+
- name: Cache liburing build
29+
id: cache-liburing
30+
uses: actions/cache@v3
31+
with:
32+
path: libs/
33+
key: ${{ steps.cache-info.outputs.os }}-${{ steps.cache-info.outputs.arch }}-liburing-${{ steps.cache-info.outputs.liburing_hash }}
34+
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.12"
38+
39+
- name: Build liburing (if cache miss)
40+
if: steps.cache-liburing.outputs.cache-hit != 'true'
41+
shell: bash
42+
run: |
43+
cd libs
44+
./configure
45+
make
46+
47+
- name: Save liburing cache
48+
if: steps.cache-liburing.outputs.cache-hit != 'true'
49+
uses: actions/cache/save@v3
50+
with:
51+
path: libs/
52+
key: ${{ steps.cache-info.outputs.os }}-${{ steps.cache-info.outputs.arch }}-liburing-${{ steps.cache-info.outputs.liburing_hash }}
53+
54+
- name: Install liburing (always)
55+
shell: bash
56+
run: |
57+
cd libs
58+
sudo make install
59+
60+
- name: Install UV
61+
uses: astral-sh/setup-uv@v5
62+
with:
63+
version: "0.6.2"
64+
enable-cache: true
65+
66+
- name: Install Python dependencies (if cache miss)
67+
if: steps.cache-python.outputs.cache-hit != 'true'
68+
shell: bash
69+
run: uv sync --group dev
70+
71+
- name: Save Python dependencies cache
72+
if: steps.cache-python.outputs.cache-hit != 'true'
73+
uses: actions/cache/save@v3
74+
with:
75+
path: |
76+
.venv
77+
~/.cache/uv
78+
key: ${{ runner.os }}-py-${{ hashFiles('uv.lock') }}

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
fetch-depth: 0
18+
19+
- name: Prepare environment
20+
uses: ./.github/actions/prepare
21+
22+
- name: Lint
23+
run: uv run ruff check uringloop tests
24+
25+
- name: Run tests
26+
run: uv run pytest tests/ -v

.github/workflows/publish.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,18 @@ permissions:
1010
jobs:
1111
release-build:
1212
runs-on: ubuntu-latest
13-
1413
steps:
15-
- uses: actions/checkout@v4
16-
with:
17-
submodules: recursive # Initializes and fetches submodules
18-
fetch-depth: 0 # Needed for submodule hashes
19-
20-
- uses: actions/setup-python@v5
14+
- name: Checkout Repo
15+
uses: actions/checkout@v4
2116
with:
22-
python-version: "3.12"
17+
submodules: recursive
18+
fetch-depth: 0
2319

24-
- name: Install the liburing
25-
run: |
26-
cd libs
27-
./configure
28-
make
29-
sudo make install
30-
31-
- name: Install the latest version of uv
32-
uses: astral-sh/setup-uv@v5
33-
with:
34-
version: "0.6.2"
35-
enable-cache: true
20+
- name: Prepare environment
21+
uses: ./.github/actions/prepare
3622

3723
- name: Build release distributions
3824
run: |
39-
uv sync --group dev
4025
uv build -v --sdist
4126
4227
- name: Upload distributions

0 commit comments

Comments
 (0)