Skip to content

Commit 11a24ca

Browse files
Merge pull request #25 from WFP-VAM/feat/uv
Switch to UV and add CDI color info
2 parents 6b7acf2 + cbfa04e commit 11a24ca

29 files changed

Lines changed: 1666 additions & 582 deletions

.github/workflows/conda.yaml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- conda
6+
pull_request:
67
workflow_dispatch:
78
inputs:
89
version:
@@ -22,13 +23,13 @@ jobs:
2223
conda:
2324
runs-on: ubuntu-22.04
2425
steps:
25-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2627

2728
- name: Install Conda environment with Micromamba
2829
uses: mamba-org/setup-micromamba@v1
2930
with:
3031
environment-file: conda/build-env.yaml
31-
environment-name: build
32+
environment-name: build
3233
cache-environment: true
3334

3435
- name: Check conda env
@@ -38,30 +39,33 @@ jobs:
3839
conda info
3940
conda list
4041
41-
- name: Build conda package
42+
- name: Build hdc-tools conda package
4243
shell: bash -l {0}
4344
run: |
4445
if [[ -z "$build" ]] ; then
4546
build=${GITHUB_RUN_NUMBER:-0}
4647
fi
4748
4849
echo "Version is '$version', build is '$build'"
49-
make -C conda VERSION=$version BUILD=$build
50+
make -C conda VERSION=$version BUILD=$build build
51+
env:
52+
version: ${{ github.event.inputs.version }}
53+
build: ${{ github.event.inputs.build }}
5054

55+
- name: Copy pkgs
56+
shell: bash -l {0}
57+
run: |
5158
echo "List build directory"
5259
find conda/build/ -type f
5360
5461
echo "Copy pkgs"
5562
mkdir -p pkgs
5663
touch pkgs/built-on-$(date +%Y%m%d).txt
57-
find conda/build/ -type f -name "*.tar.bz2" | xargs -I{} mv {} pkgs/
64+
find conda/build/ -type f -name "*.conda" | xargs -I{} mv {} pkgs/
5865
ls -lh pkgs/
59-
env:
60-
version: ${{ github.event.inputs.version }}
61-
build: ${{ github.event.inputs.build }}
6266
6367
- name: Upload results (artifact)
64-
uses: actions/upload-artifact@v3
68+
uses: actions/upload-artifact@v4
6569
with:
6670
name: pkgs
6771
path: pkgs
@@ -71,9 +75,8 @@ jobs:
7175
if: ${{ github.event.inputs.publish }}
7276
shell: bash -l {0}
7377
run: |
74-
ls -lh pkgs/
75-
anaconda upload --skip-existing pkgs/*bz2
78+
ls -lh pkgs/
79+
anaconda upload --skip-existing pkgs/*conda
7680
7781
env:
78-
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
79-
82+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}

.github/workflows/main.yaml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Run Code Checks
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
format:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
14+
with:
15+
version: "latest"
16+
enable-cache: true
17+
cache-dependency-glob: "uv.lock"
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version-file: ".python-version"
23+
24+
- name: Install dependencies
25+
run: uv sync --locked --all-extras --dev
26+
27+
- name: Run ruff format
28+
run: |
29+
uv run ruff --version
30+
uv run ruff format --check hdc tests
31+
32+
linting:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
version: "latest"
41+
enable-cache: true
42+
cache-dependency-glob: "uv.lock"
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version-file: ".python-version"
48+
49+
- name: Install dependencies
50+
run: uv sync --locked --all-extras --dev
51+
52+
- name: Run ruff check
53+
run: |
54+
uv run ruff --version
55+
uv run ruff check --output-format=github hdc tests
56+
57+
- name: Run mypy
58+
run: |
59+
uv run mypy --version
60+
uv run mypy --explicit-package-bases hdc
61+
62+
wheels:
63+
needs:
64+
- format
65+
- linting
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Install uv
71+
uses: astral-sh/setup-uv@v5
72+
with:
73+
version: "latest"
74+
enable-cache: true
75+
cache-dependency-glob: "uv.lock"
76+
77+
- name: Set up Python
78+
uses: actions/setup-python@v5
79+
with:
80+
python-version-file: ".python-version"
81+
82+
- name: Install dependencies
83+
run: uv sync --locked --all-extras --dev
84+
85+
- uses: actions/cache@v4
86+
id: wheels_cache
87+
with:
88+
path: ./wheels
89+
key: wheels-${{ github.sha }}
90+
91+
- name: Build wheels unpatched
92+
if: steps.wheels_cache.outputs.cache-hit != 'true'
93+
run: |
94+
mkdir -p wheels
95+
uv build --wheel --out-dir wheels
96+
97+
- name: Patch version
98+
run: |
99+
uv run python ./scripts/patch_version.py ${GITHUB_RUN_NUMBER:-0} ./hdc/colors/_version.py
100+
101+
- name: Build wheels patched version
102+
if: steps.wheels_cache.outputs.cache-hit != 'true'
103+
run: |
104+
uv build --out-dir wheels
105+
106+
- name: Upload results (artifact)
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: wheels
110+
path: wheels
111+
if-no-files-found: error
112+
113+
tests:
114+
needs:
115+
- format
116+
- linting
117+
runs-on: ubuntu-latest
118+
steps:
119+
- uses: actions/checkout@v4
120+
121+
- name: Install uv
122+
uses: astral-sh/setup-uv@v5
123+
with:
124+
version: "latest"
125+
enable-cache: true
126+
cache-dependency-glob: "uv.lock"
127+
128+
- name: Set up Python
129+
uses: actions/setup-python@v5
130+
with:
131+
python-version-file: ".python-version"
132+
133+
- name: Install dependencies
134+
run: uv sync --locked --all-extras --dev
135+
136+
- name: Run tests with coverage
137+
run: |
138+
uv run pytest -s \
139+
--cov \
140+
--cov-report=term \
141+
tests/
142+
143+
test-wheel:
144+
needs:
145+
- format
146+
- linting
147+
- wheels
148+
runs-on: ubuntu-latest
149+
steps:
150+
- uses: actions/checkout@v4
151+
152+
- name: Install uv
153+
uses: astral-sh/setup-uv@v5
154+
with:
155+
version: "latest"
156+
157+
- name: Set up Python
158+
uses: actions/setup-python@v5
159+
with:
160+
python-version-file: ".python-version"
161+
162+
- name: Get Wheels
163+
uses: actions/download-artifact@v4
164+
with:
165+
name: wheels
166+
path: wheels
167+
168+
- name: Install dev wheel
169+
run: |
170+
WHEEL=$(find wheels/ -type f -name "*.dev*.whl" | head -1)
171+
uv pip install --system "$WHEEL[ui,mpl]"
172+
173+
- name: Test code from the wheel
174+
run: |
175+
cd tests/
176+
uv pip install --system pytest
177+
uv run --no-project pytest -s .

0 commit comments

Comments
 (0)