Debian Codegraph @

.github/workflows/go.yml

raw
1 name: Go
2
3 on:
4 push:
5 branches: [master]
6 pull_request:
7 branches: [master]
8
9 permissions:
10 contents: read
11
12 jobs:
13 ## TODO: conditional-changes checker is not working
14 conditional-changes:
15 runs-on: ubuntu-latest
16 permissions:
17 pull-requests: read
18 outputs:
19 doc: ${{ steps.filter.outputs.doc }}
20 steps:
21 - uses: actions/checkout@v6
22 - uses: dorny/paths-filter@v3
23 id: filter
24 with:
25 filters: |
26 doc:
27 - 'site/**'
28
29 check-modules:
30 name: check-synced-go-modules
31 # needs: conditional-changes
32 # if: needs.conditional-changes.outputs.doc == 'false'
33 runs-on: [ubuntu-latest]
34 steps:
35 - name: Check out code into the Go module directory
36 uses: actions/checkout@v6
37 with:
38 fetch-depth: 0
39 - name: Set up Go 1.x
40 uses: actions/setup-go@v6
41 with:
42 go-version-file: go.work
43 cache: true
44 cache-dependency-path: |
45 **/go.sum
46 id: go
47 - name: sync go modules
48 run: make workspace-sync
49 - name: check for changes with 'make workspace-sync'
50 run: git diff --exit-code
51
52 lint:
53 name: Lint
54 # needs: conditional-changes
55 # if: needs.conditional-changes.outputs.doc == 'false'
56 runs-on: [ubuntu-latest]
57 steps:
58 - name: Check out code into the Go module directory
59 uses: actions/checkout@v6
60 with:
61 fetch-depth: 0
62 - name: Set up Go 1.x
63 uses: actions/setup-go@v6
64 with:
65 go-version-file: go.work
66 cache: true
67 cache-dependency-path: |
68 **/go.sum
69 id: go
70 - name: Lint
71 run: make lint
72 - name: Verify boilerplate
73 run: make check-license
74
75 ## Test all modules without plugins and released modules
76 test-non-released-modules:
77 name: Test Linux
78 # needs: conditional-changes
79 # if: needs.conditional-changes.outputs.doc == 'false'
80 runs-on: [ubuntu-latest]
81 steps:
82 - name: Check out code into the Go module directory
83 uses: actions/checkout@v6
84 - name: Set up Go 1.x
85 uses: actions/setup-go@v6
86 with:
87 go-version-file: go.work
88 cache: true
89 cache-dependency-path: |
90 **/go.sum
91 id: go
92 - name: Test all modules without plugins and released modules
93 run: make test-unit-non-plugin-and-non-released
94 env:
95 KUSTOMIZE_DOCKER_E2E: true
96
97 test-modules:
98 name: Test ${{ matrix.os }} - ${{ matrix.module }}
99 # needs: conditional-changes
100 # if: needs.conditional-changes.outputs.doc == 'false'
101 runs-on: ${{ matrix.os }}
102 strategy:
103 fail-fast: false
104 matrix:
105 os: [ubuntu-latest, macos-latest, windows-latest]
106 module:
107 - kyaml
108 - cmd/config
109 - api
110 - kustomize
111 include:
112 - module: kyaml
113 test-cmd: go test -race -v -cover ./...
114 - module: cmd/config
115 test-cmd: go test -v -cover ./...
116 - module: api
117 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)"
118 - module: kustomize
119 test-cmd: go test -v -cover ./...
120 - os: ubuntu-latest
121 docker-e2e: true
122 - os: macos-latest
123 docker-e2e: false
124 - os: windows-latest
125 docker-e2e: false
126 env:
127 KUSTOMIZE_DOCKER_E2E: ${{ matrix.docker-e2e }}
128 steps:
129 - name: Check out code into the Go module directory
130 uses: actions/checkout@v6
131 - name: Set up Go 1.x
132 uses: actions/setup-go@v6
133 with:
134 go-version-file: go.work
135 cache: true
136 cache-dependency-path: |
137 **/go.sum
138 id: go
139 - name: Test ${{ matrix.module }}
140 run: ${{ matrix.test-cmd }}
141 # TODO (#4001): replace specific modules above with this once Windows tests are passing.
142 if: ${{ !(matrix.os == 'windows-latest' && (matrix.module == 'api' || matrix.module == 'kustomize')) }}
143 working-directory: ./${{ matrix.module }}
144
145 # Aggregation matrix tests from test-modules for branch protection rules
146 test-modules-summary:
147 name: Test Summary
148 runs-on: ubuntu-latest
149 needs: test-modules
150 if: always()
151 steps:
152 - name: Check test results
153 run: |
154 if [[ "${{ needs.test-modules.result }}" != "success" ]]; then
155 echo "Some tests failed or were cancelled"
156 exit 1
157 fi
158 echo "All tests passed successfully"