Skip to content

Commit

Permalink
GitHub Actions maintenance (#173)
Browse files Browse the repository at this point in the history
* Bump actions/checkout to v4

* Use uv; update Python versions

* Seed setuptools in virtual environments

* Install setuptools

* Use sys.executable for more reliable correct python executable

* Fix Python executable path

* Bump codecov/codecov-action
  • Loading branch information
jayqi authored Apr 29, 2024
1 parent 5a1883e commit 4bef7e5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11 with uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: |
uv pip install -r dev-requirements.txt
- name: Build examples and docs
run: |
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python 3.11 with uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: 3.7
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
uv pip install -r dev-requirements.txt
- name: Build package
id: build_package
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11 with uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
uv pip install -r dev-requirements.txt
- name: Lint package
run: |
Expand All @@ -40,28 +39,27 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }} with uv
uses: drivendataorg/setup-python-uv-action@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
uv pip install -r dev-requirements.txt
- name: Test Package
run: |
make test
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Expand All @@ -71,21 +69,20 @@ jobs:
- name: Build distribution and test installation
shell: bash
run: |
uv pip install setuptools # Need this because we still use setup.py
make dist
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
PYTHON_BIN=Scripts/python
PYTHON_BIN=Scripts/python.exe
else
PYTHON_BIN=bin/python
fi
echo "=== Testing wheel installation ==="
python -m venv .venv-whl
.venv-whl/$PYTHON_BIN -m pip install --upgrade pip
.venv-whl/$PYTHON_BIN -m pip install dist/deon-*.whl
uv virtualenv .venv-whl --seed
uv pip install dist/deon-*.whl --python=.venv-whl/$PYTHON_BIN
.venv-whl/$PYTHON_BIN -m deon --help
echo "=== Testing source installation ==="
python -m venv .venv-sdist
.venv-sdist/$PYTHON_BIN -m pip install --upgrade pip
.venv-sdist/$PYTHON_BIN -m pip install dist/deon-*.tar.gz --force-reinstall
uv virtualenv .venv-sdist --seed
uv pip install dist/deon-*.tar.gz --python=.venv-sdist/$PYTHON_BIN
.venv-sdist/$PYTHON_BIN -m deon --help
- name: Test Building Docs
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
reqs:
pip install -r dev-requirements.txt

examples: reqs
examples:
deon --output examples/ethics.md --overwrite
deon --output examples/ethics.ipynb --overwrite
deon --output examples/ethics.html --overwrite
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import subprocess
import sys
import itertools as it
from click.testing import CliRunner

Expand Down Expand Up @@ -42,7 +43,7 @@ def test_cli_output(runner, checklist, tmpdir, test_format_configs, arg):
@pytest.mark.parametrize(
"call,format",
it.product(
[["deon"], ["python", "-m", "deon"]],
[["deon"], [sys.executable, "-m", "deon"]],
["ascii", "html", "jupyter", "markdown", "rmarkdown", "rst"],
),
)
Expand Down

0 comments on commit 4bef7e5

Please sign in to comment.