Skip to content

Commit d0385e4

Browse files
committed
👷 test on main
1 parent 1b6d657 commit d0385e4

File tree

7 files changed

+115
-46
lines changed

7 files changed

+115
-46
lines changed

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: lint
22

33
on:
44
pull_request:

.github/workflows/publish.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: Publishing
1+
name: publish
22

33
on:
44
release:
55
types:
66
- published
77

88
jobs:
9-
pypi-publish:
10-
name: PyPI
9+
pypi:
10+
name: pypi
1111
if: github.repository_owner == 'juftin'
1212
runs-on: ubuntu-latest
1313
environment:
1414
name: pypi
15-
url: https://pypi.org/p/browsr
15+
url: https://pypi.org/p/lunchable
1616
permissions:
1717
id-token: write
1818
steps:
@@ -21,7 +21,31 @@ jobs:
2121
with:
2222
checkout: true
2323
setup-uv: true
24-
task: build
24+
task: dist
2525
github-token: ${{ secrets.GITHUB_TOKEN }}
26-
- name: Publish package on PyPI
26+
- name: pypi
2727
uses: pypa/gh-action-pypi-publish@release/v1
28+
29+
docker:
30+
name: docker
31+
if: github.repository_owner == 'juftin'
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: docker-hub
35+
uses: docker/login-action@v2
36+
with:
37+
username: ${{ secrets.DOCKER_USERNAME }}
38+
password: ${{ secrets.DOCKER_TOKEN }}
39+
- name: version
40+
run: |
41+
TAG_NAME="${{ github.event.release.tag_name }}"
42+
RELEASE_VERSION="${TAG_NAME#v}"
43+
echo "RELEASE_VERSION=${RELEASE_VERSION}"
44+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> ${GITHUB_ENV}
45+
- name: docker
46+
uses: juftin/actions/taskfile@v1
47+
with:
48+
checkout: true
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
task: publish
51+
buildx: true
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: test
22

33
on:
44
push:
@@ -7,17 +7,18 @@ on:
77
paths:
88
- browsr/**
99
- pyproject.toml
10-
- .github/workflows/tests.yaml
10+
- uv.lock
11+
- .github/workflows/test.yaml
1112
pull_request:
12-
branches: ["**"]
1313
paths:
1414
- browsr/**
1515
- pyproject.toml
16-
- .github/workflows/tests.yaml
16+
- uv.lock
17+
- .github/workflows/test.yaml
1718
schedule:
1819
- cron: 0 12 1 * *
1920
jobs:
20-
test-suite:
21+
test:
2122
runs-on: ubuntu-latest
2223
strategy:
2324
fail-fast: true
@@ -42,6 +43,6 @@ jobs:
4243
install: true
4344
github-token: ${{ secrets.GITHUB_TOKEN }}
4445
annotations-pytest: ${{ matrix.python == '3.12' && true || false }}
45-
pytest-coverage: ${{ matrix.python == '3.12' && true || false }}
46+
pytest-coverage: ${{ matrix.python == '3.12' && github.event_name == 'pull_request' && true || false }}
4647
env:
4748
UV_PYTHON: ${{ matrix.python }}

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ repos:
3636
language: system
3737
types:
3838
- python
39+
- id: uv-lock
40+
name: uv-lock
41+
description: Runs uv lock when pyproject.toml changes
42+
entry: uv lock
43+
language: system
44+
pass_filenames: false
45+
files: pyproject.toml
3946
- id: prettier
4047
name: prettier
4148
description: Runs Prettier Code Formatter

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ a pleasant <strong>file explorer</strong> in your terminal supporting <strong>al
1212
<a href="https://github.com/juftin/browsr"><img src="https://img.shields.io/pypi/v/browsr?color=blue&label=%F0%9F%97%82%EF%B8%8F%20browsr" alt="PyPI"></a>
1313
<a href="https://pypi.python.org/pypi/browsr/"><img src="https://img.shields.io/pypi/pyversions/browsr" alt="PyPI - Python Version"></a>
1414
<a href="https://github.com/juftin/browsr/blob/main/LICENSE"><img src="https://img.shields.io/github/license/juftin/browsr?color=blue&label=License" alt="GitHub License"></a>
15-
<a href="https://github.com/juftin/browsr/actions/workflows/tests.yaml?query=branch%3Amain"><img src="https://github.com/juftin/browsr/actions/workflows/tests.yaml/badge.svg?branch=main" alt="Testing Status"></a>
15+
<a href="https://github.com/juftin/browsr/actions/workflows/test.yaml?query=branch%3Amain"><img src="https://github.com/juftin/browsr/actions/workflows/test.yaml/badge.svg?branch=main" alt="Testing Status"></a>
1616
<a href="https://github.com/go-task/task"><img src="https://img.shields.io/badge/task---?message=task&logo=task&color=teal&labelColor=grey" alt="task"></a>
1717
<a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a>
1818
<a href="https://github.com/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-lightgreen?logo=pre-commit" alt="pre-commit"></a>

Taskfile.yaml

Lines changed: 68 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ version: "3"
44

55
env:
66
UV_LOCKED: 1
7+
vars:
78
SOURCE_CODE: "browsr"
9+
DOCKER_REPO: juftin/browsr
10+
811
tasks:
12+
#######################################
913
default:
1014
desc: Install Project, List Tasks
1115
cmds:
1216
- task --list-all
1317
deps: [sync]
14-
#################################
15-
# REQUIRED TASKS
16-
#################################
18+
#######################################
1719
install:
1820
desc: Install Project + Dev Dependencies
1921
cmds:
2022
- task: pre-commit-install
2123
- task: sync
24+
#######################################
2225
test:
2326
desc: Run Tests
2427
cmds:
@@ -31,6 +34,7 @@ tasks:
3134
env:
3235
GITHUB_TOKEN: placeholder
3336
UV_PYTHON: "{{.UV_PYTHON}}"
37+
#######################################
3438
test:matrix:
3539
desc: Run Tests with different Python versions
3640
cmds:
@@ -40,6 +44,7 @@ tasks:
4044
task: test
4145
vars:
4246
UV_PYTHON: "{{.ITEM.PYTHON}}"
47+
#######################################
4348
lint:
4449
desc: Run Code Linters
4550
cmds:
@@ -48,48 +53,82 @@ tasks:
4853
vars:
4954
CLI_ARGS: --check
5055
deps: [sync]
56+
#######################################
57+
fmt:
58+
desc: Run Code Formatters
59+
cmds:
60+
- uv run -- ruff format {{.CLI_ARGS | default .ROOT_DIR}}
61+
deps: [sync]
62+
#######################################
5163
fix:
5264
desc: Fix Code with Linters and Formatters
5365
cmds:
5466
- task: fmt
5567
- uv run -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}}
5668
deps: [sync]
57-
build:
69+
#######################################
70+
check:
71+
desc: Run Static Type Checkers
72+
cmds:
73+
- |
74+
uv run -- \
75+
mypy \
76+
--ignore-missing-imports \
77+
{{.CLI_ARGS | default .SOURCE_CODE}}
78+
status:
79+
- '[$(uv tree --package mypy) != ""]'
80+
requires:
81+
vars: [SOURCE_CODE]
82+
#######################################
83+
dist:
5884
desc: Build the Project Artifacts
5985
cmds:
6086
- cmd: rm -rf {{.ROOT_DIR}}/dist
6187
- cmd: uv build
88+
#######################################
89+
docker:
90+
desc: Build Docker Image
91+
cmd: |
92+
docker buildx build \
93+
--tag {{.DOCKER_REPO}}:{{.RELEASE_VERSION}} \
94+
--tag {{.DOCKER_REPO}}:latest \
95+
--file {{.ROOT_DIR}}/Dockerfile \
96+
{{.CLI_ARGS | default ""}} \
97+
{{.ROOT_DIR}}
98+
vars:
99+
RELEASE_VERSION:
100+
ref: .RELEASE_VERSION | default "local"
101+
requires:
102+
vars: [DOCKER_REPO]
103+
status:
104+
- test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}}
105+
#######################################
106+
build:
107+
desc: Build the Project Artifacts
108+
cmds:
109+
- task: dist
110+
- task: docker
111+
#######################################
62112
publish:
63113
desc: Publish the Project Artifacts
64114
cmds:
65-
- task: build
115+
- task: docker
116+
vars:
117+
CLI_ARGS: --push
66118
requires:
67119
vars: [CI, RELEASE_VERSION]
68-
#################################
69-
# NON-REQUIRED + COMPOSITE TASKS
70-
#################################
120+
#######################################
121+
docs:
122+
desc: Generate Documentation
123+
cmds:
124+
- uv run --group docs -- mkdocs {{.CLI_ARGS | default "serve"}}
125+
#######################################
71126
run:
72127
desc: Run Command within Project (requires "--")
73128
interactive: true
74129
cmds:
75130
- uv run -- {{.CLI_ARGS}}
76-
fmt:
77-
desc: Run Code Formatters
78-
cmds:
79-
- uv run -- ruff format {{.CLI_ARGS | default .ROOT_DIR}}
80-
deps: [sync]
81-
check:
82-
desc: Run Static Type Checkers
83-
cmds:
84-
- |
85-
uv run -- \
86-
mypy \
87-
--ignore-missing-imports \
88-
{{.CLI_ARGS | default .SOURCE_CODE}}
89-
status:
90-
- '[$(uv tree --package mypy) != ""]'
91-
requires:
92-
vars: [SOURCE_CODE]
131+
#######################################
93132
docker-run:
94133
desc: Run Command within Docker Container (supports "--" for command)
95134
interactive: true
@@ -107,26 +146,24 @@ tasks:
107146
- test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}}
108147
requires:
109148
vars: [DOCKER_REPO]
149+
#######################################
110150
lock:
111151
desc: Regenerate the Project Lockfile
112152
cmds:
113153
- uv lock
114154
env:
115155
UV_LOCKED: "0"
116-
docs:
117-
desc: Generate Documentation
118-
cmds:
119-
- uv run --group docs -- mkdocs {{.CLI_ARGS | default "serve"}}
120-
########################
156+
#######################################
121157
# INTERNAL TASKS
122-
########################
158+
#######################################
123159
sync:
124160
desc: Install Project Dependencies
125161
internal: true
126162
cmds:
127163
- uv sync --all-extras {{.CLI_ARGS}}
128164
env:
129165
UV_PYTHON: "{{.UV_PYTHON}}"
166+
#######################################
130167
pre-commit-install:
131168
desc: Install Pre-Commit Hooks
132169
internal: true

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ a pleasant <strong>file explorer</strong> in your terminal supporting <strong>al
1212
<a href="https://github.com/juftin/browsr"><img src="https://img.shields.io/pypi/v/browsr?color=blue&label=%F0%9F%97%82%EF%B8%8F%20browsr" alt="PyPI"></a>
1313
<a href="https://pypi.python.org/pypi/browsr/"><img src="https://img.shields.io/pypi/pyversions/browsr" alt="PyPI - Python Version"></a>
1414
<a href="https://github.com/juftin/browsr/blob/main/LICENSE"><img src="https://img.shields.io/github/license/juftin/browsr?color=blue&label=License" alt="GitHub License"></a>
15-
<a href="https://github.com/juftin/browsr/actions/workflows/tests.yaml?query=branch%3Amain"><img src="https://github.com/juftin/browsr/actions/workflows/tests.yaml/badge.svg?branch=main" alt="Testing Status"></a>
15+
<a href="https://github.com/juftin/browsr/actions/workflows/test.yaml?query=branch%3Amain"><img src="https://github.com/juftin/browsr/actions/workflows/test.yaml/badge.svg?branch=main" alt="Testing Status"></a>
1616
<a href="https://github.com/go-task/task"><img src="https://img.shields.io/badge/task---?message=task&logo=task&color=teal&labelColor=grey" alt="task"></a>
1717
<a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a>
1818
<a href="https://github.com/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-lightgreen?logo=pre-commit" alt="pre-commit"></a>

0 commit comments

Comments
 (0)