Commit Graph

2659 Commits

Author SHA1 Message Date
Valentin Maerten
b8c5c896ce fix(ci): checkout before setup-go for cache to work 2026-01-31 18:54:03 +01:00
Valentin Maerten
5174fdcc6d chore(ci): remove redundant go mod download step 2026-01-31 18:54:03 +01:00
Valentin Maerten
bbb90542f7 fix(tests): add t.Parallel() to normalize test subtests 2026-01-31 18:54:03 +01:00
Valentin Maerten
d67cba4b29 fix: restore forward slashes for special path variables
The test proved that normalizing only in tests is not sufficient.
The production code must use forward slashes to:
1. Prevent escape sequence issues (\a, \t interpreted as bell, tab)
2. Ensure consistent behavior across platforms
3. Allow portable Taskfiles that work on all OSes
2026-01-31 18:54:03 +01:00
Valentin Maerten
aa99c052b5 test: revert compiler.go to test if normalization alone works 2026-01-31 18:54:03 +01:00
Valentin Maerten
b29c3e9f7c refactor(tests): improve cross-platform normalization helpers
- Rename normalizeLineEndings to normalizeOutput (clearer name)
- Add normalizePathSeparators helper for string path normalization
- Replace inline strings.ReplaceAll patterns with helper function
- Add unit tests for both normalization functions
2026-01-31 18:54:03 +01:00
Valentin Maerten
d0218d5656 fix(tests): handle Windows path output and disable CI fail-fast
- TestUserWorkingDirectoryWithIncluded: normalize actual output instead
  of just expected, since task outputs backslashes on Windows
- TestDynamicVariablesRunOnTheNewCreatedDir: take first line only, as
  Windows may output additional corrupted path info
- Disable fail-fast in CI to see all test failures at once
2026-01-31 18:54:03 +01:00
Valentin Maerten
5c4a484fc8 fix(tests): normalize path separators in working directory tests
On Windows, paths returned by pwd or filepath operations use
backslashes which get interpreted as escape sequences when
printed. This caused tests to fail with corrupted path output.

Fix by normalizing path separators before comparison:
- TestWhenNoDirAttributeItRunsInSameDirAsTaskfile
- TestWhenDirAttributeAndDirExistsItRunsInThatDir
- TestWhenDirAttributeItCreatesMissingAndRunsInThatDir
- TestDynamicVariablesRunOnTheNewCreatedDir
- TestUserWorkingDirectory
- TestUserWorkingDirectoryWithIncluded
2026-01-31 18:54:03 +01:00
Valentin Maerten
22de1f5a10 fix: use forward slashes for special path variables on all platforms
Use filepath.ToSlash() for ROOT_DIR, ROOT_TASKFILE, USER_WORKING_DIR,
TASK_DIR, TASKFILE, and TASKFILE_DIR to ensure consistent forward
slashes across platforms.

This fixes an issue on Windows where backslashes in paths were being
interpreted as escape sequences when used in shell commands like
`echo {{.ROOT_DIR}}`.
2026-01-31 18:54:03 +01:00
Valentin Maerten
885eaf6031 fix(tests): handle escaped backslashes in JSON output
Replace escaped backslashes (\\) before single backslashes to avoid
creating double forward slashes (D://a//task//) in normalized output.
2026-01-31 18:54:03 +01:00
Valentin Maerten
1416468002 debug: add logging to understand Windows test failures 2026-01-31 18:54:03 +01:00
Valentin Maerten
92fe5170ed fix(tests): simplify cross-platform golden file comparison
Instead of manually handling template substitution, normalize the output
before passing it to AssertWithTemplate. This keeps goldie's features
(diff, -update flag) intact while ensuring cross-platform compatibility.
2026-01-31 18:54:03 +01:00
Valentin Maerten
7a76bcd4e6 fix(tests): work around goldie AssertWithTemplate not using EqualFn
goldie's AssertWithTemplate doesn't respect the EqualFn option, so we
manually handle template substitution and use NormalizedEqual directly
for cross-platform comparison.
2026-01-31 18:54:03 +01:00
Valentin Maerten
0f6340858b fix(tests): force LF line endings in testdata for Windows
Add .gitattributes rule to ensure testdata files use LF line endings
on all platforms, preventing checksum mismatches on Windows.
2026-01-31 18:54:03 +01:00
Valentin Maerten
c96e32cdd2 fix(tests): normalize path separators in golden file comparison
- Extend normalizeLineEndings to convert backslashes to forward slashes
- Normalize TEST_DIR with filepath.ToSlash() for template data
- Fix TestIncludedTaskfileVarMerging assertion to use filepath.ToSlash()

This fixes golden file tests on Windows where paths contain backslashes.
2026-01-31 18:54:03 +01:00
Valentin Maerten
185730bed7 fix(tests): normalize paths in test assertions for Windows
Use filepath.ToSlash() in test assertions to handle Windows backslashes:
- TestIncludesOptionalImplicitFalse
- TestIncludesOptionalExplicitFalse
- TestIncludesRelativePath
2026-01-31 18:54:03 +01:00
Valentin Maerten
05358e6257 fix(ci): fix Windows test failures
- Normalize paths to forward slashes in glob.go for consistent sorting
- Use filepath.ToSlash in error messages to avoid double-escaped backslashes
- Add goldie.WithEqualFn for cross-platform line ending normalization
- Simplify CI workflow (go run ./cmd/task test)
2026-01-31 18:54:03 +01:00
Valentin Maerten
c0796e9701 chore: changelog for #2656 2026-01-31 18:53:52 +01:00
Trim21
cf54be3266 fix(node_git): always use unix path style (#2656) 2026-01-31 18:49:22 +01:00
Jens Erat
e129ae2fac docs: fix dir headline level (#2665)
The other commands in this section are on headline level 4, which probably is also the expected one for `dir`.
2026-01-28 18:21:50 +00:00
Andrey Nering
ed69256512 chore: update readme title and description to match website 2026-01-27 22:28:02 -03:00
Andrey Nering
40ad9719d4 chore(website): improve home page title, including on opengraph 2026-01-27 22:18:49 -03:00
Andrey Nering
48f75f0913 docs(cli): mention --list with --silent 2026-01-27 21:53:52 -03:00
Andrey Nering
f000ea2b22 chore(website): have a good opengraph image 2026-01-27 21:53:52 -03:00
Andrey Nering
e8be687a40 chore(website): add "edit this page on github" links 2026-01-27 21:53:52 -03:00
renovate[bot]
788605a3a9 chore(deps): update actions/setup-go action to v6 (#2662)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-26 21:42:04 +01:00
Andrey Nering
697cf442a2 docs(blog): adjust post title 2026-01-26 09:51:43 -03:00
Andrey Nering
e957edf783 chore(website): add goodx sponsor 2026-01-26 09:39:06 -03:00
Andrey Nering
09e7247d05 v3.48.0 v3.48.0 2026-01-26 09:26:23 -03:00
Andrey Nering
502f24a2ad docs(changelog): add entry for #2658 and #2660 2026-01-26 09:24:26 -03:00
Valentin Maerten
f09f31c6d5 fix: skip prompting for vars when task if condition fails
Move the prompt for required variables AFTER the if condition check.
This avoids asking the user for input when the task won't run anyway.

The order in RunTask() is now:
1. FastCompiledTask
2. Check required vars early (non-interactive mode only)
3. CompiledTask (resolve dynamic vars)
4. Check if condition → exit early if false
5. Prompt for missing vars (only if task will run)
6. Validate required vars
2026-01-26 09:21:09 -03:00
Valentin Maerten
5a78808caa fix: evaluate task-level if condition after resolving dynamic variables 2026-01-26 09:21:09 -03:00
Valentin Maerten
026c899d90 feat: support self-signed certificates for remote taskfiles (#2537) 2026-01-25 18:51:30 +01:00
Timothy Rule
f6720760b4 fix(includes): propagate silent mode from included Taskfiles to tasks (#2640) 2026-01-25 16:33:52 +01:00
Valentin Maerten
065236f076 chore: changelog for #2635 2026-01-25 16:08:11 +01:00
Timothy Rule
1bd5aa6bd5 fix: correct the value of ROOT_TASKFILE when no entrypoint (#2635) 2026-01-25 16:06:13 +01:00
Valentin Maerten
c3fd3c4b5e chore: add website/.netlify to gitignore 2026-01-25 14:26:53 +01:00
Valentin Maerten
299232ee7d fix(website): improve SEO with favicons, structured data and robots.txt (#2657) 2026-01-25 14:16:23 +01:00
Andrey Nering
12a26fa15e v3.47.0 v3.47.0 2026-01-24 20:49:48 -03:00
Andrey Nering
4ab5dec8ae fix(website): have the actual page title on open graph and twitter tags 2026-01-24 20:48:51 -03:00
Andrey Nering
af311229fe docs: new blog post about if: and required variables prompt 2026-01-24 20:48:51 -03:00
Andrey Nering
1443e2d989 chore(deps): update mvdan/sh once again
Closes #2650
2026-01-24 20:48:51 -03:00
Andrey Nering
5bf4e4a29b chore(deps): revert mvdan/sh to latest stable version (#2651)
There is an important regression on interactive commands here. See #2650
and mvdan/sh#1242.

Once mvdan/sh#1244 is merged we'll upgrade again.
2026-01-24 22:21:30 +00:00
Andrey Nering
f9052c9fdf chore(taskfile): add go.mod as a dependency of install 2026-01-24 18:49:38 -03:00
Valentin Maerten
0a82e2e053 chore: changelog for #2579 2026-01-22 21:22:47 +01:00
Valentin Maerten
6dedcafd7d feat(vars): add interactive prompting for required variables (#2579) 2026-01-22 21:20:45 +01:00
Valentin Maerten
c84cfa41f7 chore: changelog for #2564 2026-01-21 23:06:59 +01:00
Valentin Maerten
9bc1efbc47 feat: add conditional execution for tasks and commands (#2564) 2026-01-21 23:05:40 +01:00
Andrey Nering
da7eb0c855 fix(shell): fix deprecation warning 2026-01-21 14:05:52 -03:00
Andrey Nering
edb491a4d0 chore(deps): update shell interpreter
Closes #2446
Ref mvdan/sh#1182
Ref mvdan/sh#1241
2026-01-21 14:05:52 -03:00