Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed May 6, 2024
1 parent b2f6b47 commit e37cb18
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 46 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,32 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Create environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-environment: true
create-args: python=${{ matrix.python-version }}
environment-file: environments/tests/env-ci.yml
environment-file: ./environments/tests/env-ci.yml
post-cleanup: none

- name: Install OSMnx
run: |
uv pip install -e .
conda list
conda info --all
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit/
key: pre-commit-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles(".pre-commit-config.yaml") }}

- name: Run pre-commit checks
run: SKIP=no-commit-to-branch pre-commit run --all-files
run: pre-commit run --all-files
env:
SKIP: no-commit-to-branch

- name: Test docs
- name: Test docs build
run: make -C ./docs html SPHINXOPTS="-E -W --keep-going"

- name: Test code and coverage
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Pip install requirements
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- run: pip install -r environments/tests/requirements-test-build.txt

- name: Build package and twine check
- name: Install requirements
run: python -m pip install -r ./environments/tests/requirements-test-build.txt

- name: Build and validate package
run: |
validate-pyproject ./pyproject.toml
hatch build --clean
twine check --strict ./dist/*
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/test-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,19 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Create environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-environment: true
environment-file: environments/tests/env-test-minimal.yml
environment-file: ./environments/tests/env-test-minimal.yml
post-cleanup: none

- name: Install OSMnx
run: |
uv pip install -e .
micromamba list
micromamba info
- name: Run pre-commit checks
run: SKIP=no-commit-to-branch pre-commit run --all-files

- name: Test docs
run: make -C ./docs html SPHINXOPTS="-E -W --keep-going"
uv pip show --verbose osmnx
- name: Test code
run: pytest --verbose --maxfail=1 --typeguard-packages=osmnx
run: pytest --verbose --maxfail=1
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ repos:
- id: markdownlint
args: [--disable=MD013]

- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.16"
hooks:
- id: validate-pyproject

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.2"
hooks:
Expand Down
1 change: 1 addition & 0 deletions environments/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ conda-smithy
hatch
twine
uv
validate-pyproject

# typing
mypy
Expand Down
8 changes: 4 additions & 4 deletions environments/tests/env-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ channels:
- conda-forge

dependencies:
# required
- uv

# requirements
- geopandas
- networkx
- numpy
- pandas
- python
- requests
- shapely

Expand All @@ -20,13 +21,12 @@ dependencies:
- scikit-learn
- scipy

# testing
# linting/testing
- lxml
- pre-commit
- pytest
- pytest-cov
- typeguard
- uv

# docs
- furo
Expand Down
13 changes: 3 additions & 10 deletions environments/tests/env-test-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ channels:
- conda-forge

dependencies:
# required (pinned to min versions from /pyproject.toml)
- uv

# requirements (pinned to min versions from /pyproject.toml)
- geopandas=0.12
- networkx=2.5
- numpy=1.21
Expand All @@ -25,13 +27,4 @@ dependencies:

# testing
- lxml
- pre-commit
- pytest
- pytest-cov
- typeguard
- uv

# docs (sphinx pinned to version from /docs/requirements.txt)
- furo
- sphinx=7
- sphinx-autodoc-typehints
1 change: 1 addition & 0 deletions environments/tests/requirements-test-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ hatch
sphinx == 7.*
sphinx-autodoc-typehints
twine
validate-pyproject[all]
11 changes: 6 additions & 5 deletions tests/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

# update necessary python packaging packages
eval "$(conda shell.bash hook)"
conda deactivate
conda activate base
conda activate ox
mamba update conda-smithy --yes --no-banner

Expand All @@ -21,13 +21,14 @@ make -C ./docs html SPHINXOPTS="-E -W --keep-going"
python -m sphinx -E -W --keep-going -b linkcheck ./docs/source ./docs/build/linkcheck
rm -rf ./docs/build

# get the current package version number
VERSION=$(hatch version)

# build and validate the distribution then get its SHA256
# build and validate the distribution
rm -rf ./dist
validate-pyproject ./pyproject.toml
hatch build --clean
twine check --strict ./dist/*

# get the current package version number and its SHA256
VERSION=$(hatch version)
SHA=$(openssl dgst -sha256 -r "./dist/$PACKAGE-$VERSION.tar.gz" | awk '{print $1}')

# rerender the conda-forge feedstock
Expand Down

0 comments on commit e37cb18

Please sign in to comment.