Skip to content

Commit 2fe8e1e

Browse files
author
Lucas Yoon
committed
adding renovate and test scripts #1718
Signed-off-by: Lucas Yoon <[email protected]>
1 parent a173e94 commit 2fe8e1e

File tree

4 files changed

+148
-1
lines changed

4 files changed

+148
-1
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: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
ODOV3_VERSION: '3.16.1'
24+
25+
jobs:
26+
validate-devfile-schema:
27+
name: validate devfile schemas
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout current repo
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
with:
33+
path: current-repo
34+
35+
- name: Checkout devfile registry
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
repository: devfile/registry
39+
path: ${{ env.REGISTRY_PATH }}
40+
41+
- name: Setup Go
42+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
43+
with:
44+
go-version: ${{ env.GO_VERSION }}
45+
46+
- name: Install yq
47+
run: |
48+
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
49+
50+
- name: Install Ginkgo
51+
run: go install github.com/onsi/ginkgo/v2/ginkgo@${{ env.GINKGO_VERSION }}
52+
53+
- name: Validate sample
54+
run: (cd ${{ env.REGISTRY_PATH }} && bash tests/validate_devfile_schemas.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo)
55+
56+
non-terminating:
57+
name: check for non-terminating images
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
62+
with:
63+
path: current-repo
64+
fetch-depth: 0
65+
66+
- name: Checkout devfile registry
67+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
with:
69+
repository: devfile/registry
70+
path: ${{ env.REGISTRY_PATH }}
71+
72+
- name: Setup Go
73+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
74+
with:
75+
go-version: ${{ env.GO_VERSION }}
76+
77+
- name: Setup Minikube
78+
uses: manusa/actions-setup-minikube@0e8062ceff873bd77979f39cf8fd3621416afe4d # v2.13.0
79+
with:
80+
minikube version: ${{ env.MINIKUBE_VERSION }}
81+
kubernetes version: ${{ env.KUBERNETES_VERSION }}
82+
driver: "docker"
83+
github token: ${{ secrets.GITHUB_TOKEN }}
84+
start args: "--addons=ingress ${{ env.MINIKUBE_RESOURCES }}"
85+
86+
- name: Check that containers components are non terminating
87+
run: |
88+
go build -C ${{ env.REGISTRY_PATH }}/tests/check_non_terminating -o flatten-parent
89+
(cd ${{ env.REGISTRY_PATH }} && bash ${{ env.REGISTRY_PATH }}/tests/check_non_terminating.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo)

devfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
'Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
99
Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.'
1010
language: Python
11-
version: 1.0.1
11+
# version: 1.0.1
1212
provider: Red Hat
1313
tags:
1414
- Python

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)