Skip to content

Commit

Permalink
Merge branch 'master' into fix-issue-416
Browse files Browse the repository at this point in the history
  • Loading branch information
cplee authored Dec 8, 2020
2 parents 0db4492 + e47a239 commit 05418b8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 10 deletions.
15 changes: 6 additions & 9 deletions pkg/model/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package model
import (
"fmt"
"io"
"reflect"
"regexp"
"strings"

Expand Down Expand Up @@ -176,16 +177,12 @@ func (j *Job) GetMatrixes() []map[string]interface{} {
continue MATRIX
}
}
for _, include := range includes {
if commonKeysMatch(matrix, include) {
log.Debugf("Setting add'l values on matrix '%v' due to include '%v'", matrix, include)
for k, v := range include {
matrix[k] = v
}
}
}
matrixes = append(matrixes, matrix)
}
for _, include := range includes {
log.Debugf("Adding include '%v'", include)
matrixes = append(matrixes, include)
}

} else {
matrixes = append(matrixes, make(map[string]interface{}))
Expand All @@ -195,7 +192,7 @@ func (j *Job) GetMatrixes() []map[string]interface{} {

func commonKeysMatch(a map[string]interface{}, b map[string]interface{}) bool {
for aKey, aVal := range a {
if bVal, ok := b[aKey]; ok && aVal != bVal {
if bVal, ok := b[aKey]; ok && ! reflect.DeepEqual(aVal, bVal) {
return false
}
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ func (rc *RunContext) isEnabled(ctx context.Context) bool {

img := rc.platformImage()
if img == "" {
l.Infof("\U0001F6A7 Skipping unsupported platform '%+v'", job.RunsOn())
for _, runnerLabel := range job.RunsOn() {
platformName := rc.ExprEval.Interpolate(runnerLabel)
l.Infof("\U0001F6A7 Skipping unsupported platform '%+v'", platformName)
}
return false
}
return true
Expand Down
1 change: 1 addition & 0 deletions pkg/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func TestRunEvent(t *testing.T) {
{"testdata", "local-action-dockerfile", "push", "", platforms},
{"testdata", "local-action-js", "push", "", platforms},
{"testdata", "matrix", "push", "", platforms},
{"testdata", "matrix-include-exclude", "push", "", platforms},
{"testdata", "commands", "push", "", platforms},
{"testdata", "workdir", "push", "", platforms},
//{"testdata", "issue-228", "push", "", platforms}, // TODO [igni]: Remove this once everything passes
Expand Down
31 changes: 31 additions & 0 deletions pkg/runner/testdata/matrix-include-exclude/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: matrix-include-exclude
on: push

jobs:
build:
name: PHP ${{ matrix.os }} ${{ matrix.node}}
runs-on: ${{ matrix.os }}
steps:
- run: echo ${NODE_VERSION} | grep ${{ matrix.node }}
env:
NODE_VERSION: ${{ matrix.node }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]
node: [4, 6, 8, 10]
exclude:
- os: macos-latest
node: 4
include:
- os: ubuntu-16.04
node: 10

test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8.x, 10.x, 12.x, 13.x]
steps:
- run: echo ${NODE_VERSION} | grep ${{ matrix.node }}
env:
NODE_VERSION: ${{ matrix.node }}

0 comments on commit 05418b8

Please