Skip to content

Commit

Permalink
add a job for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Yuanhao Ji <[email protected]>
  • Loading branch information
shink committed Oct 8, 2024
1 parent ef6a4b3 commit 338eede
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci-subaction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,23 @@ jobs:
name: Show matrix
run: |
echo matrix=${{ steps.gen.outputs.matrix }}
list-targets-multi-files:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Matrix gen
id: gen
uses: ./subaction/list-targets
with:
workdir: ./multi-files
files: |
docker-bake.json
docker-bake.hcl
-
name: Show matrix
run: |
echo matrix=${{ steps.gen.outputs.matrix }}
7 changes: 1 addition & 6 deletions subaction/list-targets/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ runs:
with:
script: |
let def;
const files = `${{ inputs.files }}`
? `${{ inputs.files }}`
.replace(/\n/g, ',')
.split(',')
.filter(Boolean)
: [];
const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(/[\r?\n,]+/).filter(Boolean) : [];
const target = `${{ inputs.target }}`;
await core.group(`Validating definition`, async () => {
Expand Down
15 changes: 15 additions & 0 deletions test/multi-files/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
group "default" {
targets = ["t3"]
}

target "t3" {
name = "${item.tag}"
matrix = {
item = t3
}
args = {
VERSION = "${item.version}"
DUMMY_ARG = "${item.arg}"
}
tags = ["${item.tag}"]
}
14 changes: 14 additions & 0 deletions test/multi-files/docker-bake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"t3": [
{
"version": "v1",
"arg": "v1-value",
"tag": "v1-tag"
},
{
"version": "v2",
"arg": "v2-value",
"tag": "v2-tag"
}
]
}

0 comments on commit 338eede

Please sign in to comment.