Skip to content

Commit 917ddc7

Browse files
authored
🧪 Split up CI jobs (#9)
1 parent f821ae6 commit 917ddc7

File tree

3 files changed

+102
-60
lines changed

3 files changed

+102
-60
lines changed

‎.github/workflows/CI.yml‎ renamed to ‎.github/workflows/build.yml‎

Lines changed: 9 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,24 @@
1-
# This file is autogenerated by maturin v1.0.1
2-
# To update, run
3-
#
4-
# maturin generate-ci github --pytest
5-
#
6-
name: CI
1+
# These jobs should be run only on commits to main and version tags.
2+
# They test building wheels for all supported platforms and uploading them as artifacts.
3+
# For version tags, they also publish the wheels to PyPI.
4+
5+
name: build-and-release
76

87
on:
98
push:
109
branches:
1110
- main
1211
tags:
1312
- 'v*'
14-
pull_request:
1513
workflow_dispatch:
1614

1715
permissions:
1816
contents: read
1917

20-
jobs:
21-
22-
pre-commit:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v4
26-
- uses: actions/setup-python@v5
27-
with:
28-
python-version: "3.9"
29-
- uses: pre-commit/action@v3.0.1
30-
31-
test-python:
18+
env:
19+
CARGO_TERM_COLOR: always
3220

33-
runs-on: ubuntu-latest
34-
strategy:
35-
fail-fast: false
36-
matrix:
37-
python-version:
38-
- '3.9'
39-
- '3.10'
40-
- '3.11'
41-
- '3.12'
42-
- 'pypy3.9'
43-
steps:
44-
- uses: actions/checkout@v4
45-
- name: install rust stable
46-
uses: dtolnay/rust-toolchain@stable
47-
- name: cache rust
48-
uses: Swatinem/rust-cache@v2
49-
with:
50-
key: test-v1
51-
- name: set up python
52-
uses: actions/setup-python@v5
53-
with:
54-
python-version: ${{ matrix.python-version }}
55-
- run: pip install -e .[testing]
56-
env:
57-
RUST_BACKTRACE: 1
58-
- run: pip freeze
59-
# - run: pytest
21+
jobs:
6022

6123
linux:
6224
runs-on: ubuntu-latest
@@ -192,22 +154,10 @@ jobs:
192154
name: wheels
193155
path: dist
194156

195-
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
196-
check:
197-
if: always()
198-
needs: [pre-commit, test-python, linux, windows, macos, sdist]
199-
runs-on: ubuntu-latest
200-
steps:
201-
- name: Decide whether the needed jobs succeeded or failed
202-
uses: re-actors/alls-green@release/v1
203-
with:
204-
jobs: ${{ toJSON(needs) }}
205-
allowed-failures: coverage
206-
207157
release:
208158
runs-on: ubuntu-latest
209159
if: "startsWith(github.ref, 'refs/tags/')"
210-
needs: [pre-commit, test-python, linux, windows, macos, sdist]
160+
needs: [linux, windows, macos, sdist]
211161
steps:
212162
- uses: actions/download-artifact@v3
213163
with:
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# These jobs should be run on all commits, pull requests, and version tags.
2+
# They run formatting, linting and code tests.
3+
4+
name: tests
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
tags:
11+
- 'v*'
12+
pull_request:
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
21+
jobs:
22+
23+
pre-commit:
24+
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.9"
31+
- uses: pre-commit/action@v3.0.1
32+
33+
test-cargo:
34+
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: install rust stable
39+
uses: dtolnay/rust-toolchain@stable
40+
- name: cache rust
41+
uses: Swatinem/rust-cache@v2
42+
- name: Run tests
43+
run: cargo test -p analyzer --lib --verbose
44+
45+
test-python:
46+
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
os: [ubuntu-latest]
51+
python-version:
52+
- '3.9'
53+
- '3.10'
54+
- '3.11'
55+
- '3.12'
56+
- 'pypy3.9'
57+
include:
58+
- os: windows-latest
59+
python-version: '3.9'
60+
- os: macos-latest
61+
python-version: '3.9'
62+
63+
runs-on: ${{ matrix.os }}
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: install rust stable
68+
uses: dtolnay/rust-toolchain@stable
69+
- name: cache rust
70+
uses: Swatinem/rust-cache@v2
71+
with:
72+
key: test-v1
73+
- name: set up python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: ${{ matrix.python-version }}
77+
- run: pip install -e .[testing]
78+
env:
79+
RUST_BACKTRACE: 1
80+
- run: pip freeze
81+
# - run: pytest
82+
83+
check:
84+
if: always()
85+
needs: [pre-commit, test-cargo, test-python]
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Decide whether the needed jobs succeeded or failed
89+
uses: re-actors/alls-green@release/v1
90+
with:
91+
jobs: ${{ toJSON(needs) }}
92+
allowed-failures: coverage

‎crates/py_binding/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "rust_analyzer_py"
2+
name = "sphinx_rust"
33
version = "0.0.1"
44
publish = false
55
edition = "2021"

0 commit comments

Comments
 (0)