Skip to content

Commit 541965c

Browse files
author
spencer@primus
committed
Update workflows
1 parent de26bb8 commit 541965c

File tree

7 files changed

+99
-46
lines changed

7 files changed

+99
-46
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish a release to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
env:
9+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
10+
11+
jobs:
12+
# the tests must pass before release is to be made
13+
test:
14+
name: Run unit tests on a branch
15+
uses: avstack-lab/workflows/.github/workflows/test_on_branch_with_uv.yml@main
16+
with:
17+
branch: $BRANCH_NAME
18+
os: ubuntu-22.04
19+
python-versions: "[ '3.10' ]"
20+
uv-versions: "[ '0.6.14' ]"
21+
22+
# now we run the publishing protocol
23+
publish:
24+
name: Run publishing protocol
25+
needs: test
26+
uses: avstack-lab/workflows/.github/workflows/publish_to_index.yml@main
27+
with:
28+
os: ubuntu-22.04
29+
python-version: "3.10"
30+
uv-version: "0.6.14"
31+
index: "pypi"
32+
secrets:
33+
token: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish a release to TestPyPI
2+
3+
on:
4+
push:
5+
branches: [ test-release ]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
9+
10+
jobs:
11+
# the tests must pass before release is to be made
12+
test:
13+
name: Run unit tests on a branch
14+
uses: avstack-lab/workflows/.github/workflows/test_on_branch_with_uv.yml@main
15+
with:
16+
branch: $BRANCH_NAME
17+
os: ubuntu-22.04
18+
python-versions: "[ '3.10' ]"
19+
uv-versions: "[ '0.6.14' ]"
20+
21+
# now we run the publishing protocol
22+
publish:
23+
name: Run publishing protocol
24+
needs: test
25+
uses: avstack-lab/workflows/.github/workflows/publish_to_index.yml@main
26+
with:
27+
os: ubuntu-22.04
28+
python-version: "3.10"
29+
uv-version: "0.6.14"
30+
index: "testpypi"
31+
secrets:
32+
token: ${{ secrets.TESTPYPI_API_TOKEN }}

.github/workflows/test_on_main.yml

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

.github/workflows/test_on_workflows.yml

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

.github/workflows/unit_test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Run tests on a branch when pushed or PR'd
2+
3+
env:
4+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
5+
6+
on:
7+
push:
8+
branches: [ main, workflows ]
9+
pull_request:
10+
branches: [ main, workflows ]
11+
12+
jobs:
13+
call_tester:
14+
name: Run unit tests on a branch
15+
uses: avstack-lab/workflows/.github/workflows/test_on_branch_with_uv.yml@main
16+
with:
17+
branch: $BRANCH_NAME
18+
os: ubuntu-22.04
19+
python-versions: "[ '3.10' ]"

Makefile

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME := avapi
22
INSTALL_STAMP := .install.stamp
3-
POETRY := $(shell command -v poetry 2> /dev/null)
3+
UV := $(shell command -v uv 2> /dev/null)
44
PYFOLDERS := avapi tests
55
.DEFAULT_GOAL := help
66

@@ -17,10 +17,9 @@ help:
1717
@echo "Check the Makefile to know exactly what each target is doing."
1818

1919
install: $(INSTALL_STAMP)
20-
$(INSTALL_STAMP): pyproject.toml poetry.lock
21-
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
22-
# $(POETRY) install --all-extras
23-
$(POETRY) install
20+
$(INSTALL_STAMP): pyproject.toml uv.lock
21+
@if [ -z $(UV) ]; then echo "uv could not be found. See https://docs.astral.sh/uv/"; exit 2; fi
22+
# $(UV) sync --all-extras
2423
touch $(INSTALL_STAMP)
2524

2625
.PHONY: clean
@@ -30,18 +29,18 @@ clean:
3029

3130
.PHONY: lint
3231
lint: $(INSTALL_STAMP)
33-
$(POETRY) run isort --profile=black --lines-after-imports=2 --check-only $(PYFOLDERS)
34-
$(POETRY) run black --check $(PYFOLDERS) --diff
35-
$(POETRY) run flake8 --ignore=W503,E501 $(PYFOLDERS)
36-
$(POETRY) run mypy $(PYFOLDERS) --ignore-missing-imports
37-
$(POETRY) run bandit -r $(NAME) -s B608
32+
$(UV) run isort --profile=black --lines-after-imports=2 --check-only $(PYFOLDERS)
33+
$(UV) run black --check $(PYFOLDERS) --diff
34+
$(UV) run flake8 --ignore=W503,E501 $(PYFOLDERS)
35+
$(UV) run mypy $(PYFOLDERS) --ignore-missing-imports
36+
$(UV) run bandit -r $(NAME) -s B608
3837

3938
.PHONY: format
4039
format: $(INSTALL_STAMP)
41-
$(POETRY) run autoflake --remove-all-unused-imports -i -r $(PYFOLDERS) --exclude=__init__.py
42-
$(POETRY) run isort --profile=black --lines-after-imports=2 $(PYFOLDERS)
43-
$(POETRY) run black $(PYFOLDERS)
40+
$(UV) run autoflake --remove-all-unused-imports -i -r $(PYFOLDERS) --exclude=__init__.py
41+
$(UV) run isort --profile=black --lines-after-imports=2 $(PYFOLDERS)
42+
$(UV) run black $(PYFOLDERS)
4443

4544
.PHONY: test
4645
test: $(INSTALL_STAMP)
47-
$(POETRY) run pytest ./tests/ --cov-report term-missing --cov-fail-under 0 --cov $(NAME)
46+
$(UV) run pytest ./tests/ --cov-report term-missing --cov-fail-under 0 --cov $(NAME)

uv.lock

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

0 commit comments

Comments
 (0)