-
Notifications
You must be signed in to change notification settings - Fork 247
feat: introduce taskfile to replace dotrun #15610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
goulinkh
wants to merge
6
commits into
canonical:main
Choose a base branch
from
goulinkh:taskfile-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0febe85
feat: introduce taskfile to replace dotrun
goulinkh 8a33968
feat: include PR with taskfile check workflow
goulinkh ef76d3d
chore(README): include taskfile instructions
goulinkh 9ded63d
fix: new CI
goulinkh 22452ce
Merge branch 'main' into taskfile-integration
goulinkh 03b191c
feat(taskfile): add a shell script
goulinkh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: PR checks with taskfile | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
start: | ||
name: "Start Project" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Taskfile | ||
uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.40.0 | ||
|
||
- name: Start server | ||
run: | | ||
stdbuf -oL -eL task start > server.log 2>&1 & | ||
echo $! > server.pid | ||
|
||
- name: Wait for server to start | ||
run: | | ||
timeout 120 bash -c 'tail -n0 -F server.log | grep -m1 "Listening at"' | ||
|
||
- name: Print server logs | ||
if: always() | ||
run: | | ||
cat server.log || true | ||
|
||
- name: Check server is returning 200 | ||
run: | | ||
export PORT=$(grep '^\s*PORT:' taskfile.yaml | awk '{print $2}') | ||
curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost:${PORT} | ||
|
||
- name: Stop server | ||
run: | | ||
if [ -f server.pid ]; then | ||
kill $(cat server.pid) || true | ||
fi | ||
|
||
build: | ||
name: "Build Project" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Taskfile | ||
uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.40.0 | ||
|
||
- name: Build project | ||
run: task build | ||
|
||
test: | ||
name: "Test Project" | ||
runs-on: ubuntu-latest | ||
steps: | ||
# TODO: Add codecov integration when this replaces the original PR.yaml workflow | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Taskfile | ||
uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.40.0 | ||
|
||
- name: Test project | ||
run: task test | ||
|
||
lint: | ||
name: "Lint Project" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Taskfile | ||
uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.40.0 | ||
|
||
- name: Lint project | ||
run: task lint | ||
|
||
# TODO: Include inclusive naming check, which is currently in the original PR.yaml workflow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# [generated] Bracketed sections updated by Yeoman generator | ||
# [email protected] | ||
.task/ | ||
coverage/ | ||
|
||
# [os] OS & editor files | ||
Desktop.ini | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,6 @@ djlint==1.34.1 | |
pycountry==24.6.1 | ||
markdown==3.7 | ||
markupsafe==2.1.5 | ||
coverage==7.10.6 | ||
flake8==7.3.0 | ||
black==25.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
version: "3" | ||
|
||
vars: | ||
VENV_DIR: .venv | ||
VENV_BIN: "{{ .VENV_DIR }}/bin" | ||
PYTHON_BIN: "{{ .VENV_BIN }}/python3" | ||
PIP_BIN: "{{ .VENV_BIN }}/pip3" | ||
|
||
env: | ||
PORT: 8001 | ||
PYTHON_VERSION: "3.10" | ||
NODE_VERSION: "20" | ||
PATH: "{{ .VENV_BIN }}:$PATH" | ||
|
||
dotenv: [".env.local", ".env"] | ||
|
||
# Available tasks: | ||
# - start (default) | ||
# - install | ||
# - shell | ||
# - clean | ||
# - test | ||
# - lint | ||
# - format | ||
# - build | ||
tasks: | ||
default: | ||
cmds: | ||
- task: start | ||
|
||
start: | ||
desc: "Start the project" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn start | ||
|
||
install: | ||
desc: "Install Python and Node.js binaries and their packages" | ||
deps: | ||
- install-python | ||
- install-yarn | ||
cmds: | ||
- echo "Installation complete" | ||
|
||
shell: | ||
desc: "Open a shell with the virtual environment activated" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" $SHELL | ||
|
||
clean: | ||
cmds: | ||
- rm -rf static/css static/js/dist node_modules {{ .VENV_DIR }} .task | ||
|
||
test: | ||
desc: "Run all project tests" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" coverage run --source=. -m unittest discover tests | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn test-js --coverage | ||
|
||
lint: | ||
desc: "Run all project linting" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn lint-python | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn lint-ts | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn lint-js | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn lint-scss | ||
|
||
format: | ||
desc: "Run all project formatting" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn format-python | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn format-prettier | ||
- npx stylelint --fix static/**/*.scss | ||
|
||
samhotep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
build: | ||
desc: "Build the project static files" | ||
deps: | ||
- install | ||
cmds: | ||
- PATH="{{ .VENV_BIN }}:$PATH" yarn build | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, should have mentioned in the first comment: |
||
# Custom tools versioning setup (mise, python, node, etc.) | ||
setup-mise: | ||
internal: true | ||
desc: "Setup mise" | ||
preconditions: | ||
- which curl | ||
status: | ||
- ! which mise | ||
goulinkh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cmds: | ||
- curl https://mise.run | sh | ||
|
||
setup-python: | ||
deps: | ||
- setup-mise | ||
cmds: | ||
- mise install python@{{ .PYTHON_VERSION }} | ||
|
||
setup-node: | ||
deps: | ||
- setup-mise | ||
cmds: | ||
- mise install node@{{ .NODE_VERSION }} | ||
|
||
# Python virtual environment | ||
venv: | ||
internal: true | ||
desc: "Setup python virtual environment" | ||
deps: | ||
- setup-python | ||
status: | ||
- ! -f {{ .PYTHON_BIN }} | ||
goulinkh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cmds: | ||
- mise exec python@{{ .PYTHON_VERSION }} -- python3 -m venv .venv | ||
- echo "Using Python $({{ .PYTHON_BIN }} --version)" | ||
|
||
install-python: | ||
internal: true | ||
desc: "Install python packages" | ||
deps: | ||
- venv | ||
sources: | ||
- requirements.txt | ||
generates: | ||
- "{{ .VENV_DIR }}/*" | ||
cmds: | ||
- "{{ .PIP_BIN }} install -r requirements.txt" | ||
|
||
# Node.js package manager | ||
install-yarn: | ||
internal: true | ||
desc: "Install yarn packages" | ||
deps: | ||
- setup-node | ||
status: | ||
- which yarn | ||
- which node | ||
sources: | ||
- yarn.lock | ||
- package.json | ||
generates: | ||
- "node_modules/**" | ||
cmds: | ||
- yarn install |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.