Skip to content

Commit

Permalink
DRY github workflow
Browse files Browse the repository at this point in the history
Make install deps, build, and install actions re-usable.

Signed-off-by: Bryan Hundven <[email protected]>
  • Loading branch information
bhundven committed Oct 15, 2024
1 parent c406d14 commit 71183cf
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 19 deletions.
12 changes: 12 additions & 0 deletions .github/actions/build_thinkfan/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build thinkfan
description: 'Composite action to build thinkfan.'

runs:
using: composite
steps:
- name: build
run: |
mkdir build
cmake -B build
cmake --build build
shell: bash
10 changes: 10 additions & 0 deletions .github/actions/install_thinkfan/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Install thinkfan
description: 'Composite action to install thinkfan.'

runs:
using: composite
steps:
- name: install
run: |
sudo cmake --install ${{ github.workspace }}/build
shell: bash
11 changes: 11 additions & 0 deletions .github/actions/install_thinkfan_deps/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Install thinkfan Dependencies
description: 'Composite action to install thinkfan dependencies.'

runs:
using: composite
steps:
- name: install-deps
run: |
sudo apt update
sudo apt install -y libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev
shell: bash
14 changes: 4 additions & 10 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ jobs:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- uses: actions/checkout@v2
- name: install-deps
run: sudo apt install libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev
- name: build
run: |
mkdir build
cmake -B build
cmake --build build
- name: install
run: sudo cmake --install ${{ github.workspace }}/build
- uses: actions/checkout@v4
- uses: ./.github/actions/install_thinkfan_deps
- uses: ./.github/actions/build_thinkfan
- uses: ./.github/actions/install_thinkfan
12 changes: 3 additions & 9 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -44,12 +43,7 @@ jobs:
# 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
queries: +security-and-quality


- name: build
run: |
mkdir build
cmake -B build
cmake --build build
- uses: ./.github/actions/build_thinkfan

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down

0 comments on commit 71183cf

Please sign in to comment.