Skip to content

Commit 463f1ec

Browse files
authored
Merge pull request #45 from JslYoon/devfile#1721
[Devfile#1721] Adding renovate.json and test script to ensure sample can still be parsed and used by consumers for go sample
2 parents cff4cde + 6006b69 commit 463f1ec

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v4
25+
with:
26+
go-version-file: "go.mod"
27+
28+
- name: Build
29+
run: go build -v ./...
30+
31+
- name: Test
32+
run: go test -v ./...
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Validate with Devfile Registry Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
MINIKUBE_VERSION: 'v1.29.0'
16+
MINIKUBE_RESOURCES: '--memory 14gb --cpus 4'
17+
KUBERNETES_VERSION: 'v1.25.2'
18+
TEST_DELTA: false
19+
REGISTRY_PATH: ${{ github.workspace }}/registry
20+
GO_VERSION: '1.23'
21+
GINKGO_VERSION: v2.19.0
22+
YQ_VERSION: v4.44.1
23+
24+
jobs:
25+
validate-devfile-schema:
26+
name: validate devfile schemas
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout current repo
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
path: current-repo
33+
34+
- name: Checkout devfile registry
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36+
with:
37+
repository: devfile/registry
38+
path: ${{ env.REGISTRY_PATH }}
39+
40+
- name: Setup Go
41+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
42+
with:
43+
go-version: ${{ env.GO_VERSION }}
44+
45+
- name: Install yq
46+
run: |
47+
curl -sL -O https://github.com/mikefarah/yq/releases/download/${{ env.YQ_VERSION }}/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq
48+
49+
- name: Install Ginkgo
50+
run: go install github.com/onsi/ginkgo/v2/ginkgo@${{ env.GINKGO_VERSION }}
51+
52+
- name: Validate sample
53+
run: (cd ${{ env.REGISTRY_PATH }} && bash tests/validate_devfile_schemas.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo)
54+
55+
non-terminating:
56+
name: check for non-terminating images
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61+
with:
62+
path: current-repo
63+
fetch-depth: 0
64+
65+
- name: Checkout devfile registry
66+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
67+
with:
68+
repository: devfile/registry
69+
path: ${{ env.REGISTRY_PATH }}
70+
71+
- name: Setup Go
72+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
73+
with:
74+
go-version: ${{ env.GO_VERSION }}
75+
76+
- name: Setup Minikube
77+
uses: manusa/actions-setup-minikube@0e8062ceff873bd77979f39cf8fd3621416afe4d # v2.13.0
78+
with:
79+
minikube version: ${{ env.MINIKUBE_VERSION }}
80+
kubernetes version: ${{ env.KUBERNETES_VERSION }}
81+
driver: "docker"
82+
github token: ${{ secrets.GITHUB_TOKEN }}
83+
start args: "--addons=ingress ${{ env.MINIKUBE_RESOURCES }}"
84+
85+
- name: Check that containers components are non terminating
86+
run: |
87+
go build -C ${{ env.REGISTRY_PATH }}/tests/check_non_terminating -o flatten-parent
88+
(cd ${{ env.REGISTRY_PATH }} && bash ${{ env.REGISTRY_PATH }}/tests/check_non_terminating.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo)

renovate.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["local>devfile-samples/.github:renovate-config"],
4+
"enabledManagers": ["gomod", "dockerfile"],
5+
"gomod": {
6+
"fileMatch": ["go\\.mod$", "go\\.sum$"]
7+
},
8+
"packageRules": [
9+
{
10+
"matchManagers": ["gomod"],
11+
"groupName": "go dependencies",
12+
"groupSlug": "go-deps",
13+
"commitMessageTopic": "Go {{depName}}"
14+
},
15+
{
16+
"matchManagers": ["dockerfile"],
17+
"groupName": "dockerfile dependencies",
18+
"groupSlug": "dockerfile-deps",
19+
"commitMessageTopic": "Dockerfile {{depName}}"
20+
}
21+
]
22+
}

0 commit comments

Comments
 (0)