Skip to content

Commit 09de050

Browse files
committed
.github/workflow: refactor
Rename files and replace CI_REPO with the new CI_WORKFLOW. Add a ci_workflow variable for each of the subworkflows (setup/init, tests, archive and cleanup). Use ci-workflow branch from kdevops fork github.com/dkruces/linux-kdevops. Add reusable/ subfolder in workflows/ to place all subworkflows. Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
1 parent accf272 commit 09de050

File tree

5 files changed

+102
-49
lines changed

5 files changed

+102
-49
lines changed
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
# This can be used towards the end of your action. All tasks here run even if
44
# any of the previous tasks failed.
55

6-
name: Kdevops cleanup workflow
6+
name: Kdevops Archive Workflow
77

88
on:
99
workflow_call: # Makes this workflow reusable
10+
inputs:
11+
ci_workflow:
12+
required: false
13+
type: string
14+
default: 'demo'
1015

1116
jobs:
12-
cleanup:
13-
name: Archive results and cleanup
17+
archive:
18+
name: Archive results
1419
runs-on: [self-hosted, Linux, X64]
1520
steps:
1621
- name: Set Linux kdevops development path
@@ -33,7 +38,7 @@ jobs:
3338
if: ${{ job.status != 'cancelled' }}
3439
run: |
3540
cd kdevops
36-
CI_REPO="${{ github.ref_name }}" make ci-archive
41+
make ci-archive CI_WORKFLOW="${{ inputs.ci_workflow }}"
3742
3843
- name: Upload our kdevops results archive
3944
if: ${{ job.status != 'cancelled' }}

.github/workflows/cleanup.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# This can be used towards the end of your action. All tasks here run even if
4+
# any of the previous tasks failed.
5+
6+
name: Kdevops Cleanup Workflow
7+
8+
on:
9+
workflow_call: # Makes this workflow reusable
10+
inputs:
11+
ci_workflow:
12+
required: false
13+
type: string
14+
default: 'demo'
15+
16+
jobs:
17+
cleanup:
18+
name: Cleanup
19+
runs-on: [self-hosted, Linux, X64]
20+
if: always()
21+
steps:
22+
- name: Run kdevops make destroy
23+
run: |
24+
cd kdevops
25+
make destroy
26+
cd ..
27+
rm -rf kdevops
Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
---
3-
name: Run blktests kdevops CI tests
3+
name: Run Kdevops CI Workflow
44

55
on:
66
schedule:
@@ -24,12 +24,16 @@ on:
2424
kernel_ref:
2525
description: "Linux tree git reference (branch/tag/commit-id)"
2626
required: true
27-
default: "master"
27+
default: 'master'
2828
type: string
29+
ci_workflow:
30+
required: false
31+
type: string
32+
default: 'demo'
2933

3034
jobs:
3135
generate_ref:
32-
name: Determine kernel_ref value
36+
name: Determine Linux kernel Git Reference
3337
runs-on: [self-hosted]
3438
outputs:
3539
kernel_ref: ${{ steps.set_kernel_ref.outputs.kernel_ref }}
@@ -66,53 +70,28 @@ jobs:
6670
6771
setup:
6872
needs: generate_ref
69-
uses: ./.github/workflows/kdevops-init.yml
73+
uses: ./.github/workflows/setup.yml
7074
with:
7175
kernel_ref: ${{ needs.generate_ref.outputs.kernel_ref || 'master' }}
7276
kernel_tree: ${{ needs.generate_ref.outputs.kernel_tree || 'linux' }}
77+
ci_workflow: ${{ inputs.ci_workflow || github.ref_name }}
7378
secrets: inherit
7479

7580
run-tests:
7681
needs: setup
77-
name: Run CI tests
78-
runs-on: [self-hosted, Linux, X64]
79-
steps:
80-
- name: Run CI tests
81-
run: |
82-
cd kdevops
83-
CI_REPO="${{ github.ref_name }}" make ci-test
84-
85-
echo -e "Kernel tests results:\n" > ci.commit_extra
86-
87-
find workflows/blktests/results/last-run/ -name '*.dmesg.log' \
88-
-exec tail -n 1 {} + >> ci.commit_extra
89-
90-
echo -e "\n\n" >> ci.commit_extra
91-
echo -e "Userspace test results:\n" >> ci.commit_extra
92-
find workflows/blktests/results/last-run/ -name '*.userspace.log' \
93-
-exec tail -n 1 {} + >> ci.commit_extra
94-
echo -e "\n\n" >> ci.commit_extra
95-
96-
if grep -i -q "fail" ci.commit_extra ; then
97-
echo "fail" > ci.result
98-
else
99-
echo "ok" > ci.result
100-
fi
82+
uses: ./.github/workflows/tests.yml
83+
with:
84+
ci_workflow: ${{ inputs.ci_workflow || github.ref_name }}
85+
secrets: inherit
10186

10287
archive:
10388
needs: run-tests
104-
uses: ./.github/workflows/kdevops-archive.yml
89+
uses: ./.github/workflows/archive.yml
90+
with:
91+
ci_workflow: ${{ inputs.ci_workflow || github.ref_name }}
10592
secrets: inherit
10693

10794
cleanup:
108-
name: Cleanup
10995
needs: [setup, run-tests, archive]
110-
runs-on: [self-hosted, Linux, X64]
111-
if: always()
112-
steps:
113-
- name: Run kdevops make destroy
114-
run: |
115-
cd kdevops
116-
make destroy
117-
cd ..
118-
rm -rf kdevops
96+
uses: ./.github/workflows/cleanup.yml
97+
secrets: inherit
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# - Installs your Linux kernel tree on them
1212
# - Builds all of your test requirements for your Linux kernel tree
1313

14-
name: Base kdevops workflow
14+
name: Kdevops Setup Workflow
1515

1616
on:
1717
workflow_call: # Makes this workflow reusable
@@ -22,11 +22,15 @@ on:
2222
kernel_tree:
2323
required: false
2424
type: string
25-
default: "linux"
25+
default: 'linux'
2626
kernel_ref:
2727
required: false
2828
type: string
29-
default: "master"
29+
default: 'master'
30+
ci_workflow:
31+
required: false
32+
type: string
33+
default: 'demo'
3034

3135
jobs:
3236
setup:
@@ -42,7 +46,7 @@ jobs:
4246
- name: Checkout kdevops
4347
run: |
4448
rm -rf kdevops
45-
git clone --branch ci-repo https://github.com/dkruces/kdevops kdevops
49+
git clone --branch ci-workflow https://github.com/dkruces/kdevops kdevops
4650
4751
- name: Checkout custom branch with delta on kdevops/linux
4852
run: |
@@ -58,7 +62,7 @@ jobs:
5862
run: |
5963
cd kdevops
6064
if [[ -z "${{ inputs.kdevops_defconfig }}" ]]; then
61-
KDEVOPS_DEFCONFIG=${{ github.ref_name }}
65+
KDEVOPS_DEFCONFIG=${{ inputs.ci_workflow }}
6266
else
6367
KDEVOPS_DEFCONFIG="${{ inputs.kdevops_defconfig }}"
6468
fi
@@ -156,4 +160,4 @@ jobs:
156160
- name: Build required ci tests
157161
run: |
158162
cd kdevops
159-
CI_REPO="${{ github.ref_name }}" make ci-build-test
163+
make ci-build-test CI_WORKFLOW=${{ inputs.ci_workflow }}

.github/workflows/tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
name: Kdevops Test Workflow
4+
5+
on:
6+
workflow_call: # Makes this workflow reusable
7+
inputs:
8+
ci_workflow:
9+
required: false
10+
type: string
11+
default: 'demo'
12+
13+
jobs:
14+
tests:
15+
name: Run CI tests
16+
runs-on: [self-hosted, Linux, X64]
17+
steps:
18+
- name: Run CI tests
19+
run: |
20+
cd kdevops
21+
make ci-test CI_WORKFLOW="${{ inputs.ci_workflow }}"
22+
23+
echo -e "Kernel tests results:\n" > ci.commit_extra
24+
25+
find workflows/blktests/results/last-run/ -name '*.dmesg.log' \
26+
-exec tail -n 1 {} + >> ci.commit_extra
27+
28+
echo -e "\n\n" >> ci.commit_extra
29+
echo -e "Userspace test results:\n" >> ci.commit_extra
30+
find workflows/blktests/results/last-run/ -name '*.userspace.log' \
31+
-exec tail -n 1 {} + >> ci.commit_extra
32+
echo -e "\n\n" >> ci.commit_extra
33+
34+
if grep -i -q "fail" ci.commit_extra ; then
35+
echo "fail" > ci.result
36+
else
37+
echo "ok" > ci.result
38+
fi

0 commit comments

Comments
 (0)