-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Issue: matrix example works in github but not in act #909
Comments
This comment has been minimized.
This comment has been minimized.
Here is another example: https://stackoverflow.com/a/62953566 name: test
on:
workflow_dispatch:
jobs:
job1:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.job1.outputs.matrix)}}
steps:
- run: echo "project=${{ matrix.project }}; config=${{ matrix.config }}" Log[test/job1] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest
[test/job1] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[test/job1] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job1] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job1] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/job1] ⭐ Run echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
[test/job1] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/Arhey/Code/iptv-org/iptv/workflow/set-matrix] user= workdir=
[test/job1] ⚙ ::set-output:: matrix={"include":[{"project":"foo","config":"Debug"},{"project":"bar","config":"Release"}]}
[test/job1] ✅ Success - echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
[test/job2] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest
[test/job2] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[test/job2] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/job2] ⭐ Run echo "project=${{ matrix.project }}; config=${{ matrix.config }}"
[test/job2] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/Arhey/Code/iptv-org/iptv/workflow/0] user= workdir=
| project=; config=
[test/job2] ✅ Success - echo "project=${{ matrix.project }}; config=${{ matrix.config }}" And here is an example that currently gives the correct result: name: test
on:
workflow_dispatch:
jobs:
job2:
runs-on: ubuntu-latest
strategy:
matrix:
project: []
config: []
include:
- project: foo
config: Debug
- project: bar
config: Release
steps:
- run: echo "project=${{ matrix.project }}; config=${{ matrix.config }}" Log[test/job2-1] 🧪 Matrix: map[config:Debug project:foo]
[test/job2-1] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest
[test/job2-2] 🧪 Matrix: map[config:Release project:bar]
[test/job2-2] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest
[test/job2-1] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[test/job2-2] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[test/job2-1] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2-2] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2-2] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2-1] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/job2-1] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/job2-2] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/job2-1] ⭐ Run echo "project=${{ matrix.project }}; config=${{ matrix.config }}"
[test/job2-2] ⭐ Run echo "project=${{ matrix.project }}; config=${{ matrix.config }}"
[test/job2-1] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/Arhey/Code/iptv-org/iptv/workflow/0] user= workdir=
[test/job2-2] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/Arhey/Code/iptv-org/iptv/workflow/0] user= workdir=
| project=foo; config=Debug
[test/job2-1] ✅ Success - echo "project=${{ matrix.project }}; config=${{ matrix.config }}"
| project=bar; config=Release
[test/job2-2] ✅ Success - echo "project=${{ matrix.project }}; config=${{ matrix.config }}" |
Duplicate of #769 |
@freearhey While it indeed works as a workaround (thanks a lot for figuring it out!), empty arrays break "real" GitHub action runner with "The workflow is not valid. ... Matrix vector xxx does not contain any values" error. Do you have any idea of a workaround? |
System information
act
: Start image=catthehacker/ubuntu:act-latestact
version: act version 0.2.24Expected behaviour
Run job1 and then run job2
Actual behaviour
Runs job1
Workflow and/or repository
This workflow is taken from this example https://docs.github.com/en/actions/learn-github-actions/expressions#example-returning-a-json-object
workflow
Steps to reproduce
act
outputLog
The text was updated successfully, but these errors were encountered: