-
Notifications
You must be signed in to change notification settings - Fork 61
185 lines (178 loc) · 5.3 KB
/
build.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Build
run-name: ${{ github.actor }} running Build
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
push:
branches: [ main, develop ]
jobs:
build:
runs-on: ubuntu:24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: ./deploy/dependencies/install_dependencies_ubuntu_24_04.sh
shell: bash
- name: Build
run: ./tests/test_kernel_build.sh
shell: bash
- name: Install
run: ./tests/test_kernel_install.sh
shell: bash
run-kernel-module-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: ./deploy/dependencies/install_dependencies_ubuntu_24_04.sh
shell: bash
- name: Test Install
run: ./tests/test_kernel_install.sh
shell: bash
- name: Test Reload First
run: ./tests/test_kernel_reload.sh
shell: bash
- name: Test Reload Second
run: ./tests/test_kernel_reload.sh
shell: bash
run-kernel-dkms-install-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: ./deploy/dependencies/install_dependencies_ubuntu_24_04.sh
shell: bash
- name: Build
run: ./tests/test_kenel_dkms_install.sh || true
shell: bash
run-tests:
name: Run Tests
runs-on: ubuntu-24.04
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Development Dependencies
run: ./deploy/dependencies/install_development_dependencies_ubuntu_24_04.sh
shell: bash
- name: Lint with Linux checkpath
if: always()
run: ./tests/test_kernel_checkpath.sh
shell: bash
- name: Lint with pylint
if: always()
run: ./tests/test_python.sh
shell: bash
- name: Test python CLI
if: always()
run: ./tests/test_python_cli.sh
shell: bash
#- name: Test python GUI
#if: always()
#run: ./tests/test_python_gui.sh
#shell: bash
- name: Install python package
if: always()
run: ./deploy/python_install_pip_pkg.sh
shell: bash
check-kernel-module-change:
needs: [build, run-kernel-module-test, run-kernel-dkms-install-test, run-tests]
runs-on: ubuntu-24.04
outputs:
output1: ${{ steps.filter.outputs.workflows }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
workflows:
- 'kernel_module/*'
release-kernel-patch:
needs: [check-kernel-module-change]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if tagged
id: check_if_tagged
run: |
otag=$(git tag --points-at HEAD)
echo "Tag is ${otag}"
if [ -z "$otag" ]
then
hastag=0
else
hastag=1
fi
echo "hastag=$hastag" >> $GITHUB_OUTPUT
- name: Build kernel patch
if: steps.check-kernel-module-change.workflows == 'true' || steps.check_if_tagged.outputs.hastag == 1
run: ./deploy/build_kernelpatch.sh
shell: bash
- name: Set tag name
if: steps.check_if_tagged.outputs.hastag == 1
id: tag
run: |
tag=$(git describe --tags --abbrev=0)
echo "tag=$tag" >> $GITHUB_OUTPUT
tag_version=$(git describe --tags --abbrev=0 | sed 's/[^0-9.]*//g')
echo "tag_version=$tag_version" >> $GITHUB_OUTPUT
- name: Create Draft Release
if: steps.check_if_tagged.outputs.hastag == 1
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: ${{ steps.tag.outputs.tag }}
draft: true
prerelease: false
- name: Upload Release - Kernel Patch
if: steps.check_if_tagged.outputs.hastag == 1
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/linux/linux/0001-Add-legion-laptop-v${{ steps.tag.outputs.tag_version }}.patch
asset_name: 0001-Add-legion-laptop-v${{ steps.tag.outputs.tag_version }}.patch
asset_content_type: text/plain
- name: Publish Release
if: steps.check_if_tagged.outputs.hastag == 1
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
test-in-docker-container:
needs: [build, run-tests]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build containers and run tests inside them
run: ./deploy/build_containers.sh
shell: bash
test-packages:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build containers and run tests inside them
run: |
./deploy/package_testing/build_containers.sh
shell: bash