Skip to content

Update actions/checkout action to v7 #1830

Update actions/checkout action to v7

Update actions/checkout action to v7 #1830

---
name: Run Standard Tests
# Run minimal end-to-end tests for Khiops, Khiops Coclustering and KNITransfer
# Tests are lauched on Linux, Windows and macOS ; in serial and in parallel (4 procs)
# On release, it runs Standard test for binary. Plus MultiTables/SpliceJunction for KNITransfer
# On debug, it runs only Standard/Iris for Coclustering and KNITransfer and Standard/IrisLight for Khiops
# In case of errors, test results are available as artifacts for 7 days
# It is automatically triggered on PR when sources files are modified (files in src directory)
on:
workflow_dispatch:
inputs:
warning_as_error:
type: boolean
description: Treat warnings as errors
required: false
default: false
pull_request:
paths:
- '**CMakeLists.txt'
- src/**.h
- src/**.cpp
- src/**.java
- src/**.dd
- src/**.inc
- src/**.lex
- src/**.yac
- test/LearningTest/**
- .github/workflows/run-standard-tests.yml
- .github/actions/run-standard-tests/action.yml
# Cancel any ongoing run of this workflow on the same PR or ref
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref
}}
cancel-in-progress: true
env:
KhiopsBatchMode: true
jobs:
# Build the project on each platform for all targets to ensure that all sources and cmake files are correct
# The useful binaries are cached for the current run_id. It will be restored only in the same run of the
# build. The cached binaries are delete in the last job (cleanup-cache)
build-full-project:
strategy:
matrix:
build-setup:
- {os: windows-2025-vs2026, cmake-preset: windows-msvc}
- {os: ubuntu-latest, cmake-preset: linux-gcc}
- {os: ubuntu-24.04-arm, cmake-preset: linux-gcc}
- {os: macos-14, cmake-preset: macos-clang}
config: [debug, release]
runs-on: ${{ matrix.build-setup.os }}
env:
PRESET_NAME: ${{ matrix.build-setup.cmake-preset }}-${{ matrix.config }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Build all binaries
uses: ./.github/actions/build-khiops
with:
preset-name: ${{ env.PRESET_NAME }}
override-flags: -DTESTING=OFF
targets: all
- name: Cache binaries (windows)
id: cache-binaries-windows
if: runner.os == 'Windows'
uses: actions/cache@v5
with:
# We add binaries path one by one to avoid *.pdb and other msvc stuffs that generate a cache of 200Mo for windows
path: |
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/MODL.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/MODL_Coclustering.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/KNITransfer.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/KhiopsNativeInterface.dll
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/lib/KhiopsNativeInterface.lib
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/khisto.exe
key: ${{ github.run_id }}-${{ matrix.build-setup.os }}-${{ env.PRESET_NAME
}}
fail-on-cache-miss: false
- name: Cache binaries (macOS, Linux)
id: cache-binaries-unix
if: runner.os != 'Windows'
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/*
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/lib/libKhiopsNativeInterface.*
key: ${{ github.run_id }}-${{ matrix.build-setup.os }}-${{ env.PRESET_NAME
}}
fail-on-cache-miss: false
run-standard-tests:
needs: build-full-project
strategy:
fail-fast: false
matrix:
build-setup:
- {os: windows-2025-vs2026, cmake-preset: windows-msvc}
- {os: ubuntu-latest, cmake-preset: linux-gcc}
- {os: ubuntu-24.04-arm, cmake-preset: linux-gcc}
- {os: macos-14, cmake-preset: macos-clang}
running-mode: [parallel, serial]
config: [debug, release]
runs-on: ${{ matrix.build-setup.os }}
env:
PRESET_NAME: ${{ matrix.build-setup.cmake-preset }}-${{ matrix.config }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Restore cached binaries (windows)
if: runner.os == 'Windows'
id: restore-binaries-windows
uses: actions/cache/restore@v5
with:
path: |
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/MODL.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/MODL_Coclustering.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/KNITransfer.exe
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/KhiopsNativeInterface.dll
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/lib/KhiopsNativeInterface.lib
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/khisto.exe
key: ${{ github.run_id }}-${{ matrix.build-setup.os }}-${{ env.PRESET_NAME
}}
fail-on-cache-miss: true
- name: Restore cached binaries (macOS, Linux)
if: runner.os != 'Windows'
id: restore-binaries
uses: actions/cache/restore@v5
with:
path: |
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/*
${{ github.workspace }}/build/${{ env.PRESET_NAME }}/lib/libKhiopsNativeInterface.*
key: ${{ github.run_id }}-${{ matrix.build-setup.os }}-${{ env.PRESET_NAME
}}
fail-on-cache-miss: true
- name: Setup MPI (windows)
if: runner.os == 'Windows'
uses: mpi4py/setup-mpi@v1
- name: Setup MPI (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
brew install mpich
- name: Setup MPI (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install openmpi-bin
sudo update-alternatives --set mpi /usr/bin/mpicc.openmpi
sudo update-alternatives --set mpirun /usr/bin/mpirun.openmpi
- name: Run standard tests
uses: ./.github/actions/run-standard-tests
with:
warning_as_error: ${{ inputs.warning_as_error }}
running-mode: ${{ matrix.running-mode }}
config: ${{ matrix.config }}
binary-path: ${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin
testing-context-description: ${{ env.PRESET_NAME }}-${{ matrix.running-mode
}}
- name: Test khisto
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then EXT=".exe"; fi
'${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/'khisto${EXT} -e -j test/khisto/gaussian.txt test.gaussian_histogram.series.json
if diff -q test.gaussian_histogram.series.json test/khisto/gaussian_histogram_exploratory_analysis.json > /dev/null ;
then
echo "khisto is OK"
else
echo "::error::Error in khisto output"
false
fi
- name: Test khisto binary format
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then EXT=".exe"; fi
'${{ github.workspace }}/build/${{ env.PRESET_NAME }}/bin/'khisto${EXT} -b -e -j test/khisto/gaussian.bin test.gaussian_histogram.series.bin.json
if diff -q test.gaussian_histogram.series.bin.json test/khisto/gaussian_histogram_exploratory_analysis.json > /dev/null ;
then
echo "khisto is OK with binary input"
else
echo "::error::Error in khisto output with binary input"
false
fi
cleanup-cache:
# Clean up all caches belonging to the current run
if: always()
needs: run-standard-tests
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Checkout sources
uses: actions/checkout@v7
with:
sparse-checkout: .git
- name: Cleanup cache
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key for the current workflow"
cache_keys_for_delete=$(gh actions-cache list --key ${{ github.run_id }} | cut -f 1 )
set +e
echo "Deleting caches..."
for cache_key in $cache_keys_for_delete
do
gh actions-cache delete $cache_key --confirm
done
echo "Done"