Skip to content

Commit fbeb53e

Browse files
committed
Updated github workflows to make automatic tests works again
1 parent e7966ca commit fbeb53e

8 files changed

Lines changed: 66 additions & 87 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,12 @@ $ git clone https://github.com/Astropilot/thumbhash-python
44
$ cd thumbhash-python
55
```
66

7-
We recommand that you create a virtual environment:
7+
We are using `uv` as a project manager, I invite you to install it and then you can prepare the environnement with:
88
```console
9-
$ python -m venv env
10-
```
11-
12-
Then activate the environment with:
13-
```console
14-
# For linux
15-
$ source ./env/bin/activate
16-
17-
# For Windows PowerShell
18-
$ .\env\Scripts\Activate.ps1
19-
```
20-
21-
Make sure you use the latest pip version by upgrading it to prevent any error on the next steps:
22-
```console
23-
$ python -m pip install --upgrade pip
24-
```
25-
26-
Then install the project in editable mode and the dependencies with:
27-
```console
28-
$ pip install -e '.[dev,test]'
9+
$ uv sync
2910
```
3011

3112
To run all the tests you can use the following command:
3213
```console
33-
$ pytest tests
14+
$ uv run pytest tests
3415
```

.github/workflows/smokeshow.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ jobs:
1616
steps:
1717
- uses: actions/setup-python@v4
1818
with:
19-
python-version: "3.9"
19+
python-version: "3.14"
2020

2121
- run: pip install smokeshow
2222

23-
- uses: dawidd6/action-download-artifact@v3.0.0
23+
- uses: actions/download-artifact@v8
2424
with:
25-
workflow: test.yml
26-
commit: ${{ github.event.workflow_run.head_sha }}
25+
name: coverage-html
26+
path: htmlcov
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
run-id: ${{ github.event.workflow_run.id }}
2729

28-
- run: smokeshow upload coverage-html
30+
- run: uv run smokeshow upload htmlcov
2931
env:
3032
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
3133
# Threshold disable at the beginning, should be updated along with coverage progress

.github/workflows/test.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,65 +16,65 @@ jobs:
1616
fail-fast: false
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
19+
- uses: actions/checkout@v6
20+
- name: Install uv and set the Python version
21+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
cache: "pip"
25-
cache-dependency-path: pyproject.toml
26-
- uses: actions/cache@v3
27-
id: cache
28-
with:
29-
path: ${{ env.pythonLocation }}
30-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
31-
- name: Install Dependencies
32-
if: steps.cache.outputs.cache-hit != 'true'
33-
run: pip install -e .[dev,test]
34-
- name: Lint
35-
run: bash scripts/lint.sh
24+
enable-cache: true
25+
cache-dependency-glob: |
26+
pyproject.toml
27+
uv.lock
28+
- name: Install the project
29+
run: uv sync --locked --no-dev --group tests
3630
- run: mkdir coverage
3731
- name: Test
38-
run: bash scripts/test.sh
32+
run: uv run pytest --cov=thumbhash --cov-report=term-missing -o console_output_style=progress --showlocals
3933
env:
4034
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
4135
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
4236
- name: Store coverage files
43-
uses: actions/upload-artifact@v3
37+
uses: actions/upload-artifact@v7
4438
with:
45-
name: coverage
39+
name: coverage-${{ runner.os }}-${{ matrix.python-version }}
4640
path: coverage
41+
include-hidden-files: true
42+
43+
4744
coverage-combine:
4845
needs: [test]
4946
runs-on: ubuntu-latest
5047

5148
steps:
52-
- uses: actions/checkout@v3
53-
54-
- uses: actions/setup-python@v4
49+
- uses: actions/checkout@v6
50+
- name: Setup python and uv
51+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
5552
with:
56-
python-version: "3.8"
57-
cache: "pip"
58-
cache-dependency-path: pyproject.toml
59-
53+
python-version: 3.14
54+
enable-cache: true
55+
cache-dependency-glob: |
56+
pyproject.toml
57+
uv.lock
6058
- name: Get coverage files
61-
uses: actions/download-artifact@v3
59+
uses: actions/download-artifact@v8
6260
with:
63-
name: coverage
61+
pattern: coverage-*
6462
path: coverage
63+
merge-multiple: true
6564

66-
- run: pip install coverage[toml]
67-
65+
- name: Install Dependencies
66+
run: uv sync --locked --no-dev --group tests
6867
- run: ls -la coverage
69-
- run: coverage combine coverage
70-
- run: coverage report
71-
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
68+
- run: uv run coverage combine coverage
69+
- run: uv run coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
7270

7371
- name: Store coverage HTML
74-
uses: actions/upload-artifact@v3
72+
uses: actions/upload-artifact@v7
7573
with:
7674
name: coverage-html
7775
path: htmlcov
76+
include-hidden-files: true
77+
- run: uv run coverage report --fail-under=100
7878

7979
# https://github.com/marketplace/actions/alls-green#why
8080
check: # This job does nothing and is only used for the branch protection

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ dependencies = [
3333
]
3434

3535
[dependency-groups]
36-
test = [
36+
tests = [
3737
"pytest>=9.0.3",
38-
"coverage[toml]>=7.13.5",
38+
"pytest-cov>=7.1.0",
3939
]
4040
lint = [
4141
"mypy>=1.20.2",
4242
"ruff>=0.15.12",
4343
]
4444
dev = [
45-
{ include-group = "test" },
45+
{ include-group = "tests" },
4646
{ include-group = "lint" },
4747
]
4848

scripts/format.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

scripts/lint.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/test.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

uv.lock

Lines changed: 20 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)