diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..fb159b2
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -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']
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..6867e71
--- /dev/null
+++ b/.github/dependabot.yml
@@ -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"
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..7df5d20
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -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-client-16 libpq-dev
+
+ - 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
+
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 0000000..2b3904c
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -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
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..0e1c3b9
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,113 @@
+# 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-client-16 libpq-dev
+
+ - name: install systemd headers
+ run: sudo apt-get install libsystemd-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}}"
diff --git a/.github/workflows/dox.yml b/.github/workflows/dox.yml
new file mode 100644
index 0000000..3a21cc4
--- /dev/null
+++ b/.github/workflows/dox.yml
@@ -0,0 +1,153 @@
+name: API documentation
+
+on:
+ release:
+ types: [published]
+
+ push:
+ branches:
+ - main
+ paths:
+ - 'src/**'
+ - 'include/**'
+ - 'css/**'
+ - 'resources/**'
+ - 'Doxyfile'
+ - '*.md'
+ - '.github/workflows/dox.yml'
+
+ pull_request:
+ paths:
+ - 'src/**'
+ - 'include/**'
+ - 'css/**'
+ - 'resources/**'
+ - 'Doxyfile'
+ - '*.md'
+ - '.github/workflows/dox.yml'
+
+
+jobs:
+
+ apidocs:
+ name: Generate API documentation
+
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: install doxygen
+ run: sudo apt-get install doxygen
+
+ - name: Check out smax-clib
+ uses: actions/checkout@v4
+
+ - name: Generate docs
+ run: make local-dox
+
+ site-update:
+ name: Update github pages
+ needs: apidocs
+ if: github.repository_owner == 'Smithsonian' && (github.event_name == 'release' || contains(github.event.head_commit.message, 'site update'))
+
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: install doxygen
+ run: sudo apt-get install doxygen
+
+ - name: Checkout smax-clib
+ uses: actions/checkout@v4
+ with:
+ repository: Smithsonian/smax-postgres
+ path: smax-postgres
+
+ - 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: Generate docs
+ run: make -C xchange local-dox
+
+ - name: Generate docs
+ run: make -C redisx local-dox
+
+ - name: Generate docs
+ run: make -C smax-clib local-dox
+
+ - name: Generate headless README for smax-clib
+ run: make -C smax-postgres README-smax-postgres.md
+
+ - name: Generate smax-clib apidocs
+ uses: mattnotmitt/doxygen-action@v1.9.8
+ with:
+ additional-packages: font-roboto
+ working-directory: ./smax-clib
+
+ - name: Checkout gh-pages
+ uses: actions/checkout@v4
+ with:
+ ref: 'gh-pages'
+ path: site
+
+ - name: Assert site/doc/
+ run: mkdir -p site/doc
+
+ - name: Copy README
+ run: |
+ echo '' > site/doc/README.md
+ echo '
' >> site/doc/README.md
+ cat smax-clib/README-smax.md >> site/doc/README.md
+
+ - name: Copy CHANGELOG
+ run: cp smax-clib/CHANGELOG.md site/doc/
+
+ - name: Copy API documentation
+ run: cp -a smax-clib/apidoc site/
+
+ - name: Push to pages
+ run: |
+ cd site
+ git config --global user.email "$GITHUB_JOB+github-actions[bot]@users.noreply.github.com"
+ git config --global user.name "github-actions"
+ git add -A
+ git commit -m "[automated site update]" && git push || true
+
+
+ changelog-update:
+ name: Update CHANGELOG on github pages
+ if: github.repository_owner == 'Smithsonian' && contains(github.event.head_commit.message, 'changelog update')
+
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: Checkout source
+ uses: actions/checkout@v4
+
+ - name: Checkout gh-pages
+ uses: actions/checkout@v4
+ with:
+ ref: 'gh-pages'
+ path: site
+
+ - name: Assert site/doc/
+ run: mkdir -p site/doc
+
+ - name: Copy CHANGELOG
+ run: cp CHANGELOG.md site/doc/
+
+ - name: Push to pages
+ run: |
+ cd site
+ git config --global user.email "$GITHUB_JOB+github-actions[bot]@users.noreply.github.com"
+ git config --global user.name "github-actions"
+ git add -A
+ git commit -m "[automated site update]" && git push || true
+