forked from linux-kdevops/linux-fork-for-kpd
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (95 loc) · 2.91 KB
/
main.yml
File metadata and controls
107 lines (95 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# SPDX-License-Identifier: GPL-2.0
---
name: Run kdevops CI Workflow - Reusable
on:
workflow_call:
inputs:
ci_workflow:
description: "CI Workflow"
required: true
default: 'blktests_nvme'
type: string
kernel_tree:
description: "Linux kernel tree to use"
required: true
default: 'linux'
type: string
kernel_ref:
description: "Linux tree git reference (branch/tag/commit-id)"
required: true
default: 'master'
type: string
jobs:
check_ref:
name: Check Linux kernel Git Reference
runs-on: [self-hosted]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check kernel_ref exists
id: check_kernel_ref
run: |
set -euxo pipefail
ref="${{ github.event.inputs.kernel_ref }}"
tree="${{ github.event.inputs.kernel_tree }}"
mirror="/mirror/${tree}.git"
ls_remote="$(git ls-remote "$mirror" "refs/*/${ref}" || true)"
contains_branch="$(git -C "$mirror" branch --contains "${ref}" || true)"
contains_tag="$(git -C "$mirror" branch --contains "${ref}" || true)"
if [ -z "$ls_remote" ] && [ -z "$contains_branch" ] && [ -z "$contains_tag" ]; then
echo "Linux kernel ${ref} does not exist."
exit 1
fi
setup:
name: Setup kdevops workspace
runs-on: [self-hosted]
needs: [check_ref]
steps:
- name: Checkout kdevops-ci
uses: actions/checkout@v4
- name: kdevops setup
uses: ./.github/actions/setup
with:
dir: ${{ inputs.ci_workflow }}
kernel_tree: ${{ inputs.kernel_tree }}
kernel_ref: ${{ inputs.kernel_ref }}
ci_workflow: ${{ inputs.ci_workflow }}
test:
name: Run kdevops ci-test
runs-on: [self-hosted]
needs: [setup]
steps:
- name: kdevops ci-test
uses: ./.github/actions/test
with:
dir: ${{ inputs.ci_workflow }}
ci_workflow: ${{ inputs.ci_workflow }}
archive:
name: Archive kdevops
runs-on: [self-hosted]
needs: [setup, test]
steps:
- name: Start SSH Agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Archive ci-test results
uses: ./.github/actions/archive
with:
dir: ${{ inputs.ci_workflow }}
- name: Upload our kdevops results archive
uses: actions/upload-artifact@v4
with:
name: kdevops-ci-results
path: ${{ inputs.ci_workflow }}/kdevops/archive/*.zip
cleanup:
name: Cleanup kdevops workspace
runs-on: [self-hosted]
needs: [setup, test, archive]
if: always()
steps:
- name: kdevops cleanup
uses: ./.github/actions/cleanup
with:
dir: ${{ inputs.ci_workflow }}
ci_workflow: ${{ inputs.ci_workflow }}