-
Notifications
You must be signed in to change notification settings - Fork 2
154 lines (144 loc) · 4.91 KB
/
llvm-trunk-linux-mainline.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Test workflow with LLVM trunk and Linux mainline
on:
push:
branches:
- llvm-trunk
- llvm-trunk-next
paths:
- '.github/workflows/llvm-trunk-linux-mainline.yml'
- 'ci/linux-mainline/**'
- 'patches/v2.0/**'
- 'scripts/**'
workflow_dispatch:
schedule:
# Meaningless hh:mm field to avoid peak control traffic on GitHub
- cron: '44 22 * * *'
# Allow at most one run from any workflow in this repo at the same time, as most
# of them will operate on some shared directories of self-hosted runners and
# interfere with each other. Without this setting, the below could happen:
#
# T1 T2 T3 T4
# runner1 -(R1J1--------------------R1J2)-
# ---------(R2J1----R2J2)---------
#
# Now:
#
# T1 T2 T3 T4 T5 T6
# runner1 -(R1J1----R1J2)--xxxxxxxxxxxxxx--xxxxxxxxxxxxxx-
# -xxxxxxxxxxxxxx--(R2J1----R2J2)--xxxxxxxxxxxxxx-
# runner2 -xxxxxxxxxxxxxx--xxxxxxxxxxxxxx--(R3J1----R3J2)-
#
# Ideally we want a single runner to finish all jobs from a workflow before
# accepting any other job. But I don't know how.
#
# T1 T2 T3 T4 T5 T6
# runner1 -(R1J1----R1J2)--xxxxxxxxxxxxxx-----------------
# -xxxxxxxxxxxxxx--(R3J1----R3J2)-----------------
# runner2 ---------(R2J1----R2J2)--xxxxxxxxxxxxxx---------
# ---------xxxxxxxxxxxxxx--(R4J1----R4J2)---------
#
# Or maybe we should redesign the abstraction: what ought to be workflows? what
# ought to be jobs? and what ought to be steps?
concurrency:
group: ${{ github.repository }}
env:
MCDC_HOME: /home/github-runner/mcdc-workdir
jobs:
find_runner:
name: Find an available self-hosted runner
runs-on: self-hosted
# Enforce this same runner for all later jobs that depend on this one
# FIXME this requires each runner has a label the same as its name
outputs:
runner_name: ${{ runner.name }}
# Dummy, do nothing
steps:
- uses: actions/checkout@v4
install_deps:
name: 1. Install dependencies
needs: find_runner
# Enforce the same runner
runs-on: ${{ needs.find_runner.outputs.runner_name }}
outputs:
runner_name: ${{ runner.name }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: ./ci/linux-mainline/1_install_deps.sh
pull_source:
name: 2. Pull the source code and apply patches
needs: install_deps
# Enforce the same runner
runs-on: ${{ needs.install_deps.outputs.runner_name }}
outputs:
runner_name: ${{ runner.name }}
steps:
- uses: actions/checkout@v4
- name: Create a workspace from clean slate
run: |
rm -rf $MCDC_HOME
mkdir -p $MCDC_HOME
- name: Pull the source code and apply patches
run: ./ci/linux-mainline/2_pull_source.sh ${{ github.repository }} ${{ github.ref_name }}
get_llvm:
name: 3. Get LLVM
needs: pull_source
# Enforce the same runner
runs-on: ${{ needs.pull_source.outputs.runner_name }}
outputs:
runner_name: ${{ runner.name }}
steps:
- uses: actions/checkout@v4
- name: Build from source
run: ./ci/linux-mainline/3_get_llvm.sh
- name: Print LLVM build resource usage
run: |
cat /tmp/time.log
du -sh $MCDC_HOME/llvm-project
build_kernel:
name: 4. Build the kernel
needs: get_llvm
# Enforce the same runner
runs-on: ${{ needs.get_llvm.outputs.runner_name }}
outputs:
runner_name: ${{ runner.name }}
steps:
- uses: actions/checkout@v4
- name: Set up LLVM path
run: echo "$MCDC_HOME/llvm-project/build/bin" >> $GITHUB_PATH
- name: Print toolchain version
run: |
clang -v
llc --version
- name: Build the kernel
run: ./ci/linux-mainline/4_build_kernel.sh
- name: Print full kernel build log
run: cat /tmp/make.log
- name: Print kernel build resource usage
run: |
cat /tmp/time.log
du -sh $MCDC_HOME/linux
- name: Print kernel binary layout
run: |
llvm-readelf --sections -W $MCDC_HOME/linux/vmlinux
boot_kernel_and_collect_coverage:
name: 5. Boot the kernel and collect coverage
needs: build_kernel
# Enforce the same runner
runs-on: ${{ needs.build_kernel.outputs.runner_name }}
outputs:
runner_name: ${{ runner.name }}
steps:
- uses: actions/checkout@v4
- name: Set up LLVM path
run: echo "$MCDC_HOME/llvm-project/build/bin" >> $GITHUB_PATH
- name: Print toolchain version
run: |
clang -v
llc --version
- name: Boot the kernel and collect coverage
run: ./ci/linux-mainline/5_boot_kernel_and_collect_coverage.sh
- name: Print the index of coverage report (immediately after reset)
run: cat $MCDC_HOME/analysis_reset/text-coverage-reports/index.txt
- name: Print the index of coverage report
run: cat $MCDC_HOME/analysis/text-coverage-reports/index.txt