Skip to content

Commit

Permalink
Merge pull request #3 from CESNET/github-actions
Browse files Browse the repository at this point in the history
Introduce GitHub-actions workflow
  • Loading branch information
SiskaPavel authored Apr 24, 2024
2 parents 080baa7 + 295effe commit 3f1a7f8
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build

on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
container: ${{ inputs.os }}
steps:
- name: Install dependencies
run: |
dnf install -y make gcc-c++ cmake3 git rpm-build fuse3-devel
- name: Check out repository code
uses: actions/checkout@v4
- name: Mark github workspace as safe
run: git config --system --add safe.directory $PWD
- name: make
run: make
- name: make rpm
run: make rpm
- name: make install
run: make install
- name: extract artifact name
run: |
OS=${{ inputs.os }}
echo "artifactName=$(echo ${OS/:/}-rpm)" >> $GITHUB_ENV
- name: upload RPM artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactName }}
path: ./build/pkg/rpm/rpmbuild/RPMS/x86_64
retention-days: 1
38 changes: 38 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: check

on: [workflow_call]

jobs:
clang-checks:
runs-on: ubuntu-latest
container: oraclelinux:9
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: |
dnf install -y make gcc-c++ clang clang-tools-extra cmake3 git rpm-build fuse3-devel
- name: make format-check
run: make format
- name: make tidy-check
run: make tidy

editor-config:
runs-on: ubuntu-latest
container: mstruebing/editorconfig-checker
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check editorconfig
run: ec --exclude .git

include-orders:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run include-order-checker
run: "! grep -r -A 10 '#include <' src/ include/ | grep -B 10 '#include \"'"

cppcheck:
uses: ./.github/workflows/cppcheck.yml
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Continuous Integration pipeline

on: push

jobs:
check:
uses: ./.github/workflows/check.yml
build-os-matrix:
needs: check
runs-on: ubuntu-latest
outputs:
os: ${{ steps.os.outputs.os }}
steps:
- name: Build OS Array
id: os
run: |
osArray=()
osArray+=("rockylinux:9")
osArray+=("oraclelinux:8")
osArray+=("oraclelinux:9")
osArray+=("fedora:38")
osArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${osArray[@]}")
echo "Updated os list: $osArray"
echo "os=$osArray" >> $GITHUB_OUTPUT
build:
needs: [build-os-matrix]
strategy:
matrix:
os: ${{ fromJSON(needs.build-os-matrix.outputs.os) }}
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
rpm-test:
needs: [build-os-matrix, build]
strategy:
matrix:
os: ${{ fromJSON(needs.build-os-matrix.outputs.os) }}
uses: ./.github/workflows/rpm-test.yml
with:
os: ${{ matrix.os }}
27 changes: 27 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: cppcheck-action-test

on: [workflow_call]

jobs:
build:
name: cppcheck-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cppcheck
uses: SiskaPavel/cppcheck-action@main
with:
std: c++17
inline_suppression: enable
output_file: 'cppcheck_report.txt'
enable: warning,performance,portability,style,information
other_options: --error-exitcode=1
- name: Print cppcheck_report.txt
if: failure()
run: cat cppcheck_report.txt
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: cppcheck_report
path: 'cppcheck_report.txt'
25 changes: 25 additions & 0 deletions .github/workflows/rpm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test

on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
test:
runs-on: ubuntu-latest
container: ${{ inputs.os }}
steps:
- name: extract artifact name
run: |
OS=${{ inputs.os }}
echo "artifactName=$(echo ${OS/:/}-rpm)" >> $GITHUB_ENV
- name: download RPM artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.artifactName }}
- name: install RPM artifact
run: |
dnf install -y *.rpm

0 comments on commit 3f1a7f8

Please sign in to comment.