Skip to content

Commit 71183cf

Browse files
committed
DRY github workflow
Make install deps, build, and install actions re-usable. Signed-off-by: Bryan Hundven <[email protected]>
1 parent c406d14 commit 71183cf

File tree

5 files changed

+40
-19
lines changed

5 files changed

+40
-19
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Build thinkfan
2+
description: 'Composite action to build thinkfan.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: build
8+
run: |
9+
mkdir build
10+
cmake -B build
11+
cmake --build build
12+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Install thinkfan
2+
description: 'Composite action to install thinkfan.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: install
8+
run: |
9+
sudo cmake --install ${{ github.workspace }}/build
10+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Install thinkfan Dependencies
2+
description: 'Composite action to install thinkfan dependencies.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: install-deps
8+
run: |
9+
sudo apt update
10+
sudo apt install -y libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev
11+
shell: bash

.github/workflows/ccpp.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ jobs:
1313
matrix:
1414
os: [ubuntu-20.04, ubuntu-22.04]
1515
steps:
16-
- uses: actions/checkout@v2
17-
- name: install-deps
18-
run: sudo apt install libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev
19-
- name: build
20-
run: |
21-
mkdir build
22-
cmake -B build
23-
cmake --build build
24-
- name: install
25-
run: sudo cmake --install ${{ github.workspace }}/build
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/install_thinkfan_deps
18+
- uses: ./.github/actions/build_thinkfan
19+
- uses: ./.github/actions/install_thinkfan

.github/workflows/codeql.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ jobs:
2727

2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131

32-
- name: install-deps
33-
run: sudo apt install libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev
32+
- uses: ./.github/actions/install_thinkfan_deps
3433

3534
# Initializes the CodeQL tools for scanning.
3635
- name: Initialize CodeQL
@@ -44,12 +43,7 @@ jobs:
4443
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
4544
queries: +security-and-quality
4645

47-
48-
- name: build
49-
run: |
50-
mkdir build
51-
cmake -B build
52-
cmake --build build
46+
- uses: ./.github/actions/build_thinkfan
5347

5448
- name: Perform CodeQL Analysis
5549
uses: github/codeql-action/analyze@v2

0 commit comments

Comments
 (0)