Skip to content

fix: mongodb install #28

fix: mongodb install

fix: mongodb install #28

name: Build and Release
on:
push:
branches: ['*']
tags: ['v*']
pull_request:
branches: ['*']
jobs:
# Build and test job for all pushes/PRs
build:
name: Build and Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Ubuntu 22.04 removed due to C++20 compatibility issues with GCC 11.4.0
# Ubuntu 24.04 with GCC 13.3.0 provides full C++20 support required by the project
os: [ubuntu-24.04]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake git pkg-config curl \
libcurl4-openssl-dev libfmt-dev libmagick++-dev libmariadb-dev libfcgi-dev \
libxml2-dev libmemcached-dev
# Install MongoDB C++ driver from official repository
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update
sudo apt-get install -y libmongocxx-dev
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_CLI=ON \
-DBUILD_COMPILER=ON \
-DBUILD_FASTCGI=ON \
-DBUILD_TESTS=ON
- name: Build project
run: cmake --build build --parallel
- name: Run tests
run: |
cd build
ctest --output-on-failure --parallel
- name: Create DEB packages (tags only)
if: startsWith(github.ref, 'refs/tags/')
run: |
cd build
cpack -G DEB || { echo "DEB creation failed"; exit 1; }
- name: Upload DEB artifacts (tags only)
if: startsWith(github.ref, 'refs/tags/') && hashFiles('build/*.deb') != ''
uses: actions/upload-artifact@v4
with:
name: voidscript-deb-${{ matrix.os }}-${{ github.sha }}
path: build/*.deb
retention-days: 7
if-no-files-found: error
# Release job for tagged versions only
release:
name: Create GitHub Release
runs-on: ubuntu-24.04
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download DEB artifacts
uses: actions/download-artifact@v4
with:
name: voidscript-deb-ubuntu-24.04-${{ github.sha }}
path: artifacts/
- name: Get tag name
id: get_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: List available packages
run: |
echo "Available DEB packages for release:"
ls -la artifacts/*.deb || echo "No .deb files found in artifacts"
- name: Create GitHub Release
if: hashFiles('artifacts/*.deb') != ''
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.get_tag.outputs.tag }}
tag_name: ${{ steps.get_tag.outputs.tag }}
draft: false
prerelease: false
generate_release_notes: true
files: artifacts/*.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}