Skip to content

Add release to package build CICD #199

Add release to package build CICD

Add release to package build CICD #199

Workflow file for this run

---
name: Debian/Ubuntu Package
on:
workflow_dispatch:
pull_request:
paths:
- '**CMakeLists.txt'
- '**.cmake'
- .github/workflows/pack-debian.yml
push:
tags: [v*]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [debian10, ubuntu22.04, ubuntu20.04]
container:
image: ghcr.io/khiopsml/khiops/khiopsdev-${{ matrix.os }}:latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set environment variables
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Configure CMake
run: |
cmake --preset linux-gcc-release -DBUILD_JARS=ON
- name: Build Khiops binaries
run: |
cmake --build --preset linux-gcc-release --parallel \
--target MODL MODL_Coclustering KhiopsNativeInterface norm_jar khiops_jar
- name: Build package with CPack
run: cd build/linux-gcc-release && cpack -G DEB
- name: Rename the packages to include the ubuntu codename
run: |
source /etc/os-release
cd build/linux-gcc-release/packages/
for filename in *.deb
do
mv -v $filename ${filename%_*}-${VERSION_CODENAME}.${filename##*_}
done
- name: Upload the packages as artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ID }}-${{ env.VERSION_CODENAME }}
path: build/linux-gcc-release/packages/*.deb
# Test packages on a brand new runner to check:
# - the installation process (including dependencies installation)
# - that executable works (run with -v)
# - that it executes a small test
test:
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: ['debian:10', 'ubuntu:22.04', 'ubuntu:20.04']
container:
image: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set environment variables
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ID }}-${{ env.VERSION_CODENAME }}
path: artifacts
- name: Install Khiops core
run: |
apt-get update
dpkg -i ./artifacts/khiops-core* || true
apt-get -f install -y
- name: Check Khiops core installation
run: |
khiops-env --env
khiops -v
khiops_coclustering -v
- name: Install Khiops Desktop (with java)
run: |
dpkg -i ./khiops_* || true
apt-get -f install -y
- name: Check Khiops installation
run: |
khiops -v
khiops_coclustering -v
- name: Test Khiops installation
uses: ./.github/actions/test-khiops-install
test-kni:
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [debian10, ubuntu22.04, ubuntu20.04]
container:
image: ghcr.io/khiopsml/khiops/khiopsdev-${{ matrix.os }}:latest
steps:
- name: Put OS info on the environment
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ID }}-${{ env.VERSION_CODENAME }}
path: artifacts
- name: Install KNI Package
run: |
apt-get update
dpkg -i ./artifacts/kni* || true
apt-get -f install -y
- name: Checkout sources
uses: actions/checkout@v3
with:
sparse-checkout: .github
- name: Test KNI package
uses: ./.github/actions/test-kni
release:
needs: [build, test] # TODO: add kni
strategy:
matrix:
os: [debian10, ubuntu22.04, ubuntu20.04]
runs-on: ubuntu-latest
steps:
- name: Put OS info on the environment
run: |
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ID }}-${{ env.VERSION_CODENAME }}