Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build release packages for libndtp

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:

jobs:
package:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: mac
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Update vcpkg
run: |
cd external/microsoft/vcpkg
./bootstrap-vcpkg.sh

- name: Build and package
run: |
bash ops/package.sh

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: libndtp-${{ matrix.platform }}
path: packages/*.tar.gz
retention-days: 7
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: main

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:
# on:
# push:
# branches:
# - "main"
# pull_request:
# workflow_dispatch:

env:
_VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ data/
config/

output_*.json
packages/
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.23.5)

SET(VCPKG_MANIFEST_FEATURES "" CACHE STRING "vcpkg features")

project(libndtp VERSION 0.0.1)
if(NOT DEFINED LIBNDTP_VERSION)
set(LIBNDTP_VERSION "0.0.1" CACHE STRING "Version of libndtp")
endif()
project(libndtp VERSION ${LIBNDTP_VERSION})

set(TARGET_NAME "science-${PROJECT_NAME}")

Expand Down
47 changes: 47 additions & 0 deletions ops/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -e

VERSION=${1:-"0.0.1"}
PACKAGE_NAME="libndtp-${VERSION}"
BUILD_DIR="build"
SCRIPT_DIR=$(dirname "$0")
INCLUDE_DIR="$(realpath ${SCRIPT_DIR}/../include)"

PACKAGE_DIR="packages"
mkdir -p ${PACKAGE_DIR}

echo "Running CMake Configure"
cmake --preset=static -DCMAKE_BUILD_TYPE=Release -DVCPKG_MANIFEST_FEATURES=${VCPKG_MANIFEST_FEATURES} -DLIBNDTP_VERSION=${VERSION}

echo "Running Build"
cmake --build build

echo "Build complete, packaging dependencies"

TEMP_DIR=$(mktemp -d)
PACKAGE_STRUCTURE="${TEMP_DIR}/${PACKAGE_NAME}"
mkdir -p "${PACKAGE_STRUCTURE}/lib"
mkdir -p "${PACKAGE_STRUCTURE}/include"

cp ${BUILD_DIR}/liblibndtp.a "${PACKAGE_STRUCTURE}/lib/"
cp -r ${BUILD_DIR}/include/* "${PACKAGE_STRUCTURE}/include/"
cp -r ${INCLUDE_DIR}/* "${PACKAGE_STRUCTURE}/include/"

# And a readme for end users, we can add more information later
# but if they are downloading this they probably know what they want it for
cat > "${PACKAGE_STRUCTURE}/README.md" << EOF
# libndtp - Version ${VERSION}

## Contents
- **lib/** - Contains the static library (liblibndtp.a)
- **include/** - Contains all necessary header files

EOF

echo "Staging complete, bundling"

TARBALL="${PACKAGE_DIR}/${PACKAGE_NAME}.tar.gz"

tar -czf "${TARBALL}" -C "${TEMP_DIR}" "${PACKAGE_NAME}"

echo "Package created at ${TARBALL}"