Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8d9c142
Added CI to GitHub Actions with go test
riptide-01 Jun 2, 2025
c97567b
Added go-mod check to GitHub Actions
riptide-01 Jun 2, 2025
347e5fe
GitHub Actions submodules tests
riptide-01 Jun 2, 2025
7ddb9a0
GitHub Actions add stale.yml
riptide-01 Jun 2, 2025
148ebf6
GitHub Action submodules-tests as other job
riptide-01 Jun 2, 2025
e2b91ea
GitHub Actions lint-examples
riptide-01 Jun 2, 2025
5f180b8
fix
riptide-01 Jun 2, 2025
085b719
example from doc
riptide-01 Jun 2, 2025
b383b7b
revert
riptide-01 Jun 2, 2025
f450f91
lind and test to different files
riptide-01 Jun 2, 2025
9de1764
submodules crutch via go.work
riptide-01 Jun 2, 2025
acc8d60
kludge
riptide-01 Jun 2, 2025
0868316
rename job names
riptide-01 Jun 2, 2025
071976a
GitHub Actions use matrix strategy on go-test
riptide-01 Jun 2, 2025
318431b
small fixes
riptide-01 Jun 3, 2025
d858434
ci starts on pull_requests too
riptide-01 Jun 3, 2025
4399f16
Test root module as another job
riptide-01 Jun 3, 2025
fed31f7
go-test on success Test workflow
riptide-01 Jun 3, 2025
5d65193
comment unneeded jobs
riptide-01 Jun 3, 2025
da3a49b
Lint worflow
riptide-01 Jun 3, 2025
36fa701
stop unneeded jobs
riptide-01 Jun 3, 2025
4441a04
test on new pull request
riptide-01 Jun 3, 2025
afcf666
fix Lint not start on completed Test
riptide-01 Jun 3, 2025
e810129
is trouble in workflow name
riptide-01 Jun 3, 2025
73ee831
try trigger lint
riptide-01 Jun 3, 2025
053c539
improved tests
riptide-01 Jun 3, 2025
36faf4d
all test in one workflow
riptide-01 Jun 3, 2025
f2f635e
linters for all submodules
riptide-01 Jun 3, 2025
d9bf1ea
fix lint-examples dependencies in job
riptide-01 Jun 3, 2025
f2dd05c
fix tests
riptide-01 Jun 3, 2025
0e73a3d
added go-mod-examples
riptide-01 Jun 3, 2025
9bcbe06
disable fail-fast
riptide-01 Jun 3, 2025
3e0c0d5
fix dependecies in GitHub Actions Test workflow
riptide-01 Jun 3, 2025
1a1bcd3
fix empty string in go mod
riptide-01 Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 366

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- blocked
- protected
- triaged

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
129 changes: 129 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Test

on:
pull_request:
types: [opened]
push:
branches-ignore: [ main ]

env:
GO_VERSION: '1.24'
GOLANGCI_LINT_VERSION: 'v2.1'

jobs:
# Check if there is any dirty change for go mod tidy
go-mod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum

go-test:
needs: go-mod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: go test ./... -race

golangci-lint:
needs: go-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: golangci/golangci-lint-action@v8
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}

detect-modules: # ref: https://github.com/golangci/golangci-lint-action/tree/main
needs: [golangci-lint, go-test, go-mod]
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modules.outputs.modules }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Create go.work # Required for Go workspace mode to enable submodule checks and linting support (ref: https://go.dev/doc/tutorial/workspaces)
run: go work init && find . -mindepth 2 -name go.mod|sed -r 's/(.*)(go.mod)/use \1/g' >> go.work
- name: Upload go.work
uses: actions/upload-artifact@v4
with:
name: go_work
path: go.work
- id: set-modules
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT

go-mod-examples:
needs: [detect-modules]
runs-on: ubuntu-latest
strategy:
matrix:
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Check go mod
run: |
pwd
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
working-directory: ${{ matrix.modules }}

go-test-examples:
needs: [detect-modules, go-mod-examples]
runs-on: ubuntu-latest
strategy:
matrix:
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download go.work from detect-modules
uses: actions/download-artifact@v4
with:
name: go_work
- run: go test ./...
working-directory: ${{ matrix.modules }}

golangci-lint-examples:
needs: [detect-modules, go-test-examples]
runs-on: ubuntu-latest
strategy:
matrix:
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download go.work from detect-modules
uses: actions/download-artifact@v4
with:
name: go_work
- name: golangci-lint ${{ matrix.modules }}
uses: golangci/golangci-lint-action@v8
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
working-directory: ${{ matrix.modules }}
1 change: 0 additions & 1 deletion examples/basic-example-module/hooks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module basic-example-module

go 1.23.8


require github.com/deckhouse/module-sdk v0.0.0

require (
Expand Down
6 changes: 3 additions & 3 deletions examples/example-module/hooks/subfolder/patch_hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ var _ = Describe("patch hook", func() {
Expect(name).To(Equal("my-third-pod"))
})

// Set expectations for MergePatch
patchCollector.MergePatchMock.Set(func(patch any, apiVersion, kind, namespace, name string, opts ...pkg.PatchCollectorOption) {
patchMap, ok := patch.(map[string]any)
// Set expectations for PatchWithMerge
patchCollector.PatchWithMergeMock.Set(func(mergePatch any, apiVersion, kind, namespace, name string, opts ...pkg.PatchCollectorOption) {
patchMap, ok := mergePatch.(map[string]any)
Expect(ok).To(BeTrue())
Expect(patchMap).To(HaveKeyWithValue("/status", "newStatus"))
Expect(apiVersion).To(Equal("v1"))
Expand Down