Skip to content

Commit 2bbdf9d

Browse files
author
Alex Stewart
committed
.github: add a pr-check workflow
The PR check should try to build the project and lint it. If either fails, the PR shouldn't be accepted. Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
1 parent 374cdeb commit 2bbdf9d

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

.github/actions/build/action.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build Project
2+
description: Install build dependencies, build the project, and upload artifacts.
3+
4+
inputs:
5+
python-version:
6+
description: Python version to use
7+
required: false
8+
default: '3.13'
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
18+
- name: Install project python dependencies
19+
shell: bash
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.txt
23+
pip install cyclonedx-bom
24+
25+
- name: Build project
26+
shell: bash
27+
run: |
28+
make all
29+
30+
- name: Generate SBOMS
31+
shell: bash
32+
run: |
33+
mkdir -p docs/build/sbom
34+
pip freeze --all | cyclonedx-py requirements - >docs/build/sbom/host-python.sbom.cdx.json
35+
dpkg-query --list >docs/build/sbom/host-packages.sbom.txt
36+
37+
- name: Upload build artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: build
41+
path: docs/build/

.github/workflows/pr-check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PR Checks
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
Build:
7+
runs-on: ubuntu-latest
8+
9+
env:
10+
SPHINXOPTS: -W
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Build project
17+
uses: ./.github/actions/build
18+
19+
- name: Lint docs
20+
run: make lint

0 commit comments

Comments
 (0)