Skip to content

Commit 2057a76

Browse files
authored
[Devfile#1718] Merge pull request #70 from JslYoon/devfile#1718-renovate
[Devfile#1718] Adding renovate.json and test script to ensure sample can still be parsed and used by consumers
2 parents a173e94 + 322b7f7 commit 2057a76

File tree

3 files changed

+146
-0
lines changed

3 files changed

+146
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will install Python dependencies, run tests and lint with Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ["3.9", "3.10", "3.11", "3.12"]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install flake8 pytest
33+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34+
- name: Lint with flake8
35+
run: |
36+
# stop the build if there are Python syntax errors or undefined names
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
39+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40+
- name: Test with pytest
41+
run: |
42+
pytest || [ $? -eq 5 ]
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["local>devfile-samples/.github:renovate-config"],
4+
"enabledManagers": ["pip_requirements", "dockerfile"],
5+
"pip_requirements": {
6+
"fileMatch": ["requirements\\.txt$"]
7+
},
8+
"packageRules": [
9+
{
10+
"matchManagers": ["pip_requirements"],
11+
"groupName": "python dependencies",
12+
"groupSlug": "python-deps",
13+
"commitMessageTopic": "Python {{depName}}"
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)