Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging #21

Merged
merged 5 commits into from
Sep 30, 2024
Merged
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
7 changes: 7 additions & 0 deletions .cmake-format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
with section("format"):
line_width = 120
tab_size = 2
line_ending = "auto"

with section("markup"):
bullet_char = "-"
11 changes: 6 additions & 5 deletions .github/workflows/hosted-ninja-vcpkg_submod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
# - Finally builds the sources with Ninja, and tests as well.
name: hosted-ninja-vcpkg_submod-autocache
on:
push:
pull_request:
branches:
- v11
- main
workflow_dispatch:
# push:
# pull_request:
# branches:
# - v11
# - main

jobs:
job:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/hosted-pure-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
# build agents.
name: hosted-pure-workflow
on:
push:
pull_request:
branches:
- v11
- main
workflow_dispatch:
# push:
# pull_request:
# branches:
# - v11
# - main

jobs:
job:
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/pack-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
name: Conda Packages
on:
workflow_dispatch:
defaults:
run:
shell: bash -el {0}
jobs:
build:
strategy:
fail-fast: false
matrix:
setup:
- {os: ubuntu-22.04, os-family: linux-x64}
- {os: windows-2022, os-family: win-x64}
- {os: macos-13, os-family: osx-x64}
- {os: macos-14, os-family: osx-arm64}
runs-on: ${{ matrix.setup.os }}
steps:
- name: Checkout Sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: '3.12'
- name: Install Dependency Requirements for Building Conda Packages
run: conda install -y conda-build
# We need MacOS SDK 10.10 to build for macOS Intel
# See: https://docs.conda.io/projects/conda-build/en/3.21.x/resources/compiler-tools.html#macos-sdk
- name: Install Mac OS SDK 10.10
if: runner.os == 'macOS'
run: |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.10.sdk.tar.xz
sudo tar -zxvf MacOSX10.10.sdk.tar.xz -C /opt
- name: Build conda packages
run: |
conda build conda --output-folder ./builds/packages
- name: Upload conda packages artifact
uses: actions/upload-artifact@v4
with:
name: khiops-conda-${{ matrix.setup.os-family }}
path: ./builds/packages
retention-days: 7
# # Test Conda package on brand new environments
# test:
# needs: build
# strategy:
# fail-fast: false
# matrix:
# env:
# - {os: ubuntu-20.04, os-family: linux-64}
# - {os: ubuntu-22.04, os-family: linux-64}
# - {os: ubuntu-24.04, os-family: linux-64}
# - {os: windows-2019, os-family: win-64}
# - {os: windows-2022, os-family: win-64}
# - {os: macos-12, os-family: osx-64}
# - {os: macos-13, os-family: osx-64}
# - {os: macos-14, os-family: osx-arm64}
# runs-on: ${{ matrix.env.os }}
# steps:
# - name: Install Miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# miniconda-version: latest # needed for macOS 13
# python-version: ${{ matrix.python-version }}
# - name: Download Conda Package Artifact
# uses: actions/download-artifact@v4
# with:
# name: khiops-conda-${{ matrix.env.os-family }}
# path: ./build/conda
# - name: Install the Conda package (Windows)
# if: runner.os == 'Windows'
# run: conda install --channel ./build/conda khiops-core
# # In Linux/macOS we need the conda-forge channel to install their pinned versions
# - name: Install the Conda package (Linux/macOS)
# if: runner.os != 'Windows'
# run: |
# conda install --channel conda-forge --channel ./build/conda khiops-core
# - name: Add CONDA_PREFIX to shared PATH
# run: |
# echo "$CONDA_PREFIX/bin" >> $GITHUB_PATH
# - name: Checkout sources
# uses: actions/checkout@v4
# - name: Test that the executables are installed
# uses: ./.github/actions/test-khiops-install
# - name: Test that khiops on Iris dataset
# uses: ./.github/actions/test-khiops-on-iris

# # Release is only executed on tags
# # Note: For this job to work the secrets variables KHIOPS_ANACONDA_CHANNEL_TOKEN and
# # KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN must be set with valid anaconda.org access tokens
# release:
# if: github.ref_type == 'tag'
# needs: test
# runs-on: ubuntu-22.04
# permissions:
# contents: write
# steps:
# - name: Download package artifacts
# uses: actions/download-artifact@v4
# with:
# # See the upload-artifact step in the build job for the explanation of this pattern
# path: ./build/conda
# pattern: khiops-conda-*
# merge-multiple: true
# - name: Install Miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# miniconda-version: latest
# python-version: '3.12'
# - name: Install requirement packages
# run: conda install -y anaconda-client conda-index
# - name: Reindex the package directory
# run: python -m conda_index ./build/conda
# - name: Upload the packages to anaconda.org
# run: |
# # Set the anaconda.org channel
# ANACONDA_CHANNEL="${{ inputs.release-channel || 'khiops-dev' }}"

# # For the release channel: upload without forcing; do not upload kni-transfer
# if [[ "$ANACONDA_CHANNEL" == "khiops" ]]
# then
# rm -f -v ./build/conda/*/kni-transfer*.tar.bz2
# anaconda --token "${{ secrets.KHIOPS_ANACONDA_CHANNEL_TOKEN }}" upload \
# --user "$ANACONDA_CHANNEL" ./build/conda/*/*.tar.bz2
# # For the dev channel: upload with forcing
# else
# anaconda --token "${{ secrets.KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN }}" upload \
# --user "$ANACONDA_CHANNEL" --force ./build/conda/*/*.tar.bz2
# fi
# - name: Extract package version
# run: |
# PKG_VERSION=$(\
# conda search --override-channels --channel ./build/conda/ khiops-core \
# | awk '!/#|channels/ {print $2}' \
# | sort -u \
# )
# echo "PKG_VERSION=$PKG_VERSION" >> "$GITHUB_ENV"
# - name: Create the release zip archive
# uses: thedoctor0/[email protected]
# with:
# type: zip
# path: ./build/conda
# filename: khiops-${{ env.PKG_VERSION }}-conda.zip
# - name: Upload conda package artifacts for all platforms
# uses: actions/upload-artifact@v4
# with:
# name: khiops-conda-all
# path: ./khiops-${{ env.PKG_VERSION }}-conda.zip
# - name: Release the zip archive
# uses: ncipollo/release-action@v1
# with:
# allowUpdates: true
# body: |
# **This release is for testing purposes only and there is no support for it.**
# **Go to https://khiops.org to install the latest supported version.**
# draft: false
# makeLatest: false
# prerelease: true
# updateOnlyUnreleased: true

59 changes: 59 additions & 0 deletions .github/workflows/pack-debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: DEB Packages
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
image: ['debian:10', 'debian:11', 'debian:12', 'ubuntu:20.04', 'ubuntu:22.04', 'ubuntu:24.04']
container: ${{ matrix.image }}
steps:
- name: Install packages
run: |
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y --no-install-recommends install build-essential coreutils debhelper git ca-certificates curl
apt-get -y install ninja-build
apt-get -y install zip pkg-config # for vcpkkg
curl -LO "https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.sh"
bash cmake-3.30.3-linux-x86_64.sh --prefix=/usr/local/ --exclude-subdir
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Configure CMake
run: |
cmake -B builds -S . -G Ninja -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: |
cmake --build builds --target khiopsdriver_file_gcs
- name: Build package with CPack
run: cd builds/ && cpack -G DEB
- name: Set environment variables
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Rename the packages to include the ubuntu codename
run: |
cd builds/packages/
for filename in *.deb
do
mv -v $filename ${filename%_*}-${VERSION_CODENAME}.${filename##*_}
done
- name: Upload the packages as artifacts
uses: actions/upload-artifact@v4
with:
# We add a `deb-` prefix so we can later recover all artifacts with the pattern `deb-*`
# Note: The more natural pattern `*-deb` or `*` does not work
name: deb-${{ env.ID }}-${{ env.VERSION_CODENAME }}
path: builds/packages/*.deb
if-no-files-found: error

62 changes: 62 additions & 0 deletions .github/workflows/pack-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: RPM Packages
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
image: ['rockylinux:8', 'rockylinux:9']
container:
image: ${{ matrix.image }}
steps:
- name: Install packages
run: |
dnf upgrade -y
dnf install -y gcc-c++ make rpm-build # we do not use ninja because it is not in the dnf repo
dnf install -y git perl # for vcpkg
# Note: We install cmake from kitware's site to have a more recent version
curl -LO "https://github.com/Kitware/CMake/releases/download/v3.26.5/cmake-3.26.5-linux-x86_64.sh"
sh cmake-3.26.5-linux-x86_64.sh --prefix=/usr/local/ --exclude-subdir
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true

- name: Configure CMake
run: |
cmake -B builds -S . -G 'Unix Makefiles' -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: |
cmake --build builds --target khiopsdriver_file_gcs
- name: Build package with CPack
run: cd builds/ && cpack -G RPM
- name: Set environment variables
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
VERSION_CODENAME=$(echo $PLATFORM_ID | cut -d":" -f2)
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Rename packages with codename
run: |
source /etc/os-release
ARCH=$(arch)
cd builds/packages
for filename in *.rpm
do
mv -v $filename ${filename%.${ARCH}*}.${{ env.VERSION_CODENAME }}.${ARCH}.rpm
done
- name: Upload the packages as artifacts
uses: actions/upload-artifact@v4
with:
# We add a `rpm-` prefix so we can later recover all artifacts with the pattern `rpm-*`
# Note: The more natural pattern `*-rpm` or `*` does not work
name: rpm-${{ env.ID }}-${{ env.VERSION_CODENAME }}
path: builds/packages/*.rpm
if-no-files-found: error
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
/build
**/CMakeFiles
**/Makefile
*.cmake
.vscode
Loading