Skip to content

Commit

Permalink
Add CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Sep 18, 2024
1 parent 042dbcb commit 4612bf0
Show file tree
Hide file tree
Showing 6 changed files with 431 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: attipaci
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
76 changes: 76 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build

on:
push:
branches:
- main
paths:
- 'src/**'
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/build.yml'

pull_request:
paths:
- 'src/**'
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/build.yml'

jobs:

build:
name: Build library

runs-on: ubuntu-latest
env:
CC: gcc
CFLAGS: -Os -Wall -Wextra -Werror -std=c99
XCHANGE: ../xchange
REDISX: ../redisx
SMAXLIV: ../smax-clib
steps:
- name: install PostgreSQL
run: sudo apt-get install postgresql

- name: install systemd headers
run: sudo apt-get install libsystemd-dev

- name: Check out smax-postgres
uses: actions/checkout@v4
with:
repository: Smithsonian/smax-postgres
path: smax-postgres

- name: Check out smax-clib
uses: actions/checkout@v4
with:
repository: Smithsonian/smax-clib
path: smax-clib

- name: Check out xchange dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/xchange
path: xchange

- name: Check out RedisX dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/redisx
path: redisx

- name: Build xchange dependency
run: make -C xchange shared

- name: Build RedisX dependency
run: make -C redisx shared

- name: Build shared library
run: make -C smax-clib shared

- name: Build smax-postgres application
run: make -C smax-postgres

60 changes: 60 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Static Analysis

on:
push:
branches:
- main
paths:
- 'src/**'
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/check.yml'

pull_request:
paths:
- 'src/**'
- 'include/**'
- 'Makefile'
- '*.mk'
- '.github/workflows/check.yml'

jobs:

cppcheck:
name: Check source code

runs-on: ubuntu-latest
env:
CC: gcc
XCHANGE: xchange
REDISX: redisx
SMAXLIB: smax-clib
steps:

- name: Check out smax-postgres
uses: actions/checkout@v4

- name: Check out xchange dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/xchange
path: xchange

- name: Check out RedisX dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/redisx
path: redisx

- name: Check out smax-clib dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/smax-clib
path: smax-clib

- name: install package dependencies
run: sudo apt-get install -y cppcheck

- name: Run cppcheck
run: make check
116 changes: 116 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '35 18 * * 5'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: [ 'ubuntu-latest' ]
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: install PostgreSQL
run: sudo apt-get install postgresql

- name: install systemd development files
run: sudo apt-get install libsystemd-dev

- name: install popt development files
run: sudo apt-get install libpopt-dev

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

- name: Checkout xchange dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/xchange
path: xchange

- name: Checkout RedisX dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/redisx
path: redisx

- name: Checkout smax-clib dependency
uses: actions/checkout@v4
with:
repository: Smithsonian/smax-clib
path: smax-clib

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: manual

- name: Manual build dependencies
shell: bash
env:
XCHANGE: ../xchange
REDISX: ../redisx
run: |
make -C xchange shared
make -C redisx shared
make -C smax-clib shared
- name: Manual build
shell: bash
env:
XCHANGE: xchange
REDISX: redisx
SMAXLIB: smax-clib
run: |
make app
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
Loading

0 comments on commit 4612bf0

Please sign in to comment.