Skip to content

Commit 61fa6b1

Browse files
committed
wip
1 parent c1bd618 commit 61fa6b1

File tree

21 files changed

+103
-152
lines changed

21 files changed

+103
-152
lines changed

.github/workflows/go.yml

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Go
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
permissions:
1010
contents: read
@@ -39,6 +39,9 @@ jobs:
3939
uses: actions/setup-go@v6
4040
with:
4141
go-version-file: go.work
42+
cache: true
43+
cache-dependency-path: |
44+
**/go.sum
4245
id: go
4346
- name: sync go modules
4447
run: make workspace-sync
@@ -59,12 +62,16 @@ jobs:
5962
uses: actions/setup-go@v6
6063
with:
6164
go-version-file: go.work
65+
cache: true
66+
cache-dependency-path: |
67+
**/go.sum
6268
id: go
6369
- name: Lint
6470
run: make lint
6571
- name: Verify boilerplate
6672
run: make check-license
6773

74+
## test all module in this repo
6875
test-linux:
6976
name: Test Linux
7077
needs: conditional-changes
@@ -77,44 +84,57 @@ jobs:
7784
uses: actions/setup-go@v6
7885
with:
7986
go-version-file: go.work
87+
cache: true
88+
cache-dependency-path: |
89+
**/go.sum
8090
id: go
8191
- name: Test all modules
8292
run: make test-unit-non-plugin
8393
env:
8494
KUSTOMIZE_DOCKER_E2E: true
8595

86-
test-macos:
87-
name: Test MacOS
96+
test-modules:
97+
name: Test ${{ matrix.os }} - ${{ matrix.module }}
8898
needs: conditional-changes
8999
# if: needs.conditional-changes.outputs.doc == 'false'
90-
runs-on: [macos-latest]
100+
runs-on: ${{ matrix.os }}
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
os: [ubuntu-latest, macos-latest, windows-latest]
105+
module:
106+
- kyaml
107+
- cmd/config
108+
- api
109+
- kustomize
110+
include:
111+
- module: kyaml
112+
test-cmd: go test -race -v -cover ./...
113+
- module: cmd/config
114+
test-cmd: go test -v -cover ./...
115+
- module: api
116+
test-cmd: go test -v -cover ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=2023-01-31T23:38:41Z -X sigs.k8s.io/kustomize/api/provenance.version=(test)"
117+
- module: kustomize
118+
test-cmd: go test -v -cover ./...
119+
- os: ubuntu-latest
120+
docker-e2e: true
121+
- os: macos-latest
122+
docker-e2e: false
123+
- os: windows-latest
124+
docker-e2e: false
125+
env:
126+
KUSTOMIZE_DOCKER_E2E: ${{ matrix.docker-e2e }}
91127
steps:
92128
- name: Check out code into the Go module directory
93129
uses: actions/checkout@v5
94130
- name: Set up Go 1.x
95131
uses: actions/setup-go@v6
96132
with:
97133
go-version-file: go.work
134+
cache: true
135+
cache-dependency-path: |
136+
**/go.sum
98137
id: go
99-
- name: Test all modules
100-
run: make test-unit-non-plugin
101-
env:
102-
KUSTOMIZE_DOCKER_E2E: false # docker not installed on mac
103-
104-
test-windows:
105-
name: Test Windows
106-
needs: conditional-changes
107-
# if: needs.conditional-changes.outputs.doc == 'false'
108-
runs-on: [windows-latest]
109-
steps:
110-
- name: Check out code into the Go module directory
111-
uses: actions/checkout@v5
112-
- name: Set up Go 1.x
113-
uses: actions/setup-go@v6
114-
with:
115-
go-version-file: go.work
116-
id: go
117-
- name: Test all modules
118-
run: make test-unit-non-plugin
119-
env:
120-
KUSTOMIZE_DOCKER_E2E: false # docker on windows not working well yet
138+
- name: Test ${{ matrix.module }}
139+
run: ${{ matrix.test-cmd }}
140+
working-directory: ./${{ matrix.module }}

api/filters/valueadd/valueadd_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2020 The Kubernetes Authors.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// TODO: Need more investigate for windows compatibility
5+
//go:build !windows
6+
// +build !windows
7+
48
package valueadd
59

610
import (

api/internal/loader/fileloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (fl *FileLoader) errIfGitContainmentViolation(
238238
"security; bases in kustomizations found in "+
239239
"cloned git repos must be within the repo, "+
240240
"but base '%s' is outside '%s'",
241-
base, containingRepo.CloneDir())
241+
filepath.ToSlash(base.String()), filepath.ToSlash(containingRepo.CloneDir().String()))
242242
}
243243
return nil
244244
}

api/internal/loader/fileloader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ whatever
401401
require.NoError(err)
402402
repo := l.Repo()
403403
require.Equal(coRoot, repo)
404-
require.Equal(coRoot+"/"+pathInRepo, l.Root())
404+
require.Equal(coRoot+"/"+pathInRepo, filepath.ToSlash(l.Root()))
405405

406406
_, err = l.New(url)
407407
require.Error(err)

api/internal/localizer/localizer_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2022 The Kubernetes Authors.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// TODO: Skip on Windows due to this test depends onposix-OS specific filepath.
5+
//go:build !windows
6+
// +build !windows
7+
48
package localizer_test
59

610
import (

api/internal/localizer/locloader_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2022 The Kubernetes Authors.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// TODO: Skip on Windows due to this test depends onposix-OS specific filepath.
5+
//go:build !windows
6+
// +build !windows
7+
48
package localizer_test
59

610
import (

api/internal/localizer/util_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ func TestLocRootPath_SymlinkPath(t *testing.T) {
317317
}
318318

319319
func TestCleanedRelativePath(t *testing.T) {
320+
// Skip on Windows due to path separator differences
321+
testutil.SkipWindows(t)
320322
fSys := filesys.MakeFsInMemory()
321323
// Use platform-appropriate root path
322324
rootPath := string(filepath.Separator) + "root"

api/internal/target/kusttarget_configplugin.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (kt *KustTarget) configureBuiltinGenerators() (
4949
generatorOrigin = &resource.Origin{
5050
Repo: kt.origin.Repo,
5151
Ref: kt.origin.Ref,
52-
ConfiguredIn: filepath.Join(kt.origin.Path, kt.kustFileName),
52+
ConfiguredIn: filepath.ToSlash(filepath.Join(kt.origin.Path, kt.kustFileName)),
5353
ConfiguredBy: yaml.ResourceIdentifier{
5454
TypeMeta: yaml.TypeMeta{
5555
APIVersion: "builtin",
@@ -58,7 +58,6 @@ func (kt *KustTarget) configureBuiltinGenerators() (
5858
},
5959
}
6060
}
61-
6261
for i := range r {
6362
result = append(result, &resmap.GeneratorWithProperties{Generator: r[i], Origin: generatorOrigin})
6463
}
@@ -92,7 +91,7 @@ func (kt *KustTarget) configureBuiltinTransformers(
9291
transformerOrigin = &resource.Origin{
9392
Repo: kt.origin.Repo,
9493
Ref: kt.origin.Ref,
95-
ConfiguredIn: filepath.Join(kt.origin.Path, kt.kustFileName),
94+
ConfiguredIn: filepath.ToSlash(filepath.Join(kt.origin.Path, kt.kustFileName)),
9695
ConfiguredBy: yaml.ResourceIdentifier{
9796
TypeMeta: yaml.TypeMeta{
9897
APIVersion: "builtin",

api/krusty/accumulation_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"sigs.k8s.io/kustomize/api/konfig"
1818
"sigs.k8s.io/kustomize/api/krusty"
1919
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
20+
"sigs.k8s.io/kustomize/kyaml/testutil"
2021
)
2122

2223
const validResource = `
@@ -184,6 +185,8 @@ spec:
184185
}
185186

186187
func TestAccumulateResourcesErrors(t *testing.T) {
188+
// Skip on Windows due to posix-OS specific error messages.
189+
testutil.SkipWindows(t)
187190
type testcase struct {
188191
name string
189192
resource string

api/krusty/component_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"sigs.k8s.io/kustomize/api/internal/loader"
1212
"sigs.k8s.io/kustomize/api/konfig"
1313
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
14+
"sigs.k8s.io/kustomize/kyaml/testutil"
1415
)
1516

1617
type FileGen func(kusttest_test.Harness)
@@ -507,6 +508,7 @@ spec:
507508
}
508509

509510
func TestComponentErrors(t *testing.T) {
511+
testutil.SkipWindows(t)
510512
testCases := map[string]struct {
511513
input []FileGen
512514
runPath string

0 commit comments

Comments
 (0)