Comments (5)
@andreynering I'm inclined to agree that there is a valid use-case here even if it is only to reduce a bit of repetition. Can I propose the following syntax:
build:all:
desc: Build for all targets
cmds:
- for:
matrix:
ARCH: [amd64, arm64]
OS: [linux, darwin, windows]
cmd: go build -o build/${APP}-{{.ITEM.OS}}-{{.ITEM.ARCH}} .
This way it is any extension to the existing for
functionality rather than another looping keyword. This should be relatively simple to plug into the existing code.
Edit: Also related: #675
from task.
Hey @nikaro,
We already have for:
so you can loop though variables. That would sove your use case.
https://taskfile.dev/usage/#looping-over-values
from task.
Hello @andreynering,
You mean something like this?
build:all:
desc: Build for all targets
vars:
matrix:
- os: linux
arch: arm64
- os: linux
arch: amd64
- os: darwin
arch: arm64
- os: darwin
arch: darwin
- os: windows
arch: arm64
- os: windows
arch: amd64
cmds:
- for:
var: matrix
cmd: go build -o build/${APP}-{{.ITEM.os}}-{{.ITEM.arch}} .
This is a bit cleaner (as it avoids the | cut -d
hack), but still a proper matrix support would be better in terms of readability :-)
from task.
Yeah, thinking in it as an extension to for:
makes more sense 👍
from task.
I totally agree. I would add this is implemented like that in Github action and it works well
from task.
Related Issues (20)
- Errors with taskfile and windows HOT 5
- Remote file not working HOT 3
- Taskfile not trusted by user HOT 1
- feat: add `isWSL` function to detect if Task is being ran on WSL HOT 4
- documentation: env option does not override environment settings HOT 1
- Feature Request: Allow .CHECKSUM and .TIMESTAMP variables to be used in cmds
- Add default shell setting from env varibale or in yaml please!
- Honour the global-level 'run: once' setting in an included Taskfile
- Expose VARS as environment variables
- Task "generates" not working as expected HOT 5
- Env access for sh vars
- Changes to environment do not persist across tasks HOT 1
- Task label not reflected in logs when using output prefixed HOT 1
- Make `sources:` respect a new `.taskignore` file, similar to `.gitignore` HOT 4
- `TASKFILE_DIR` with incorrect value HOT 2
- Vars passed from the CLI don't seem to work HOT 3
- Included Taskfile watch: true not working
- Task-level vars are ignored during 'requires' evaluation
- Multi-line python commands fail with IndentationError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from task.