Skip to content

Commit

Permalink
[ci] Add global LABELS variable (and chenge schedule to test it)
Browse files Browse the repository at this point in the history
  • Loading branch information
Megane Millan committed Oct 15, 2024
1 parent 15082b6 commit f3ee4bb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI - Linux via APT

on:
schedule:
- cron: '0 0 * * 0'
push:
paths-ignore:
- doc/**
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI - OSX/Linux via Conda

on:
schedule:
- cron: '0 0 * * 0'
- cron: '*/30 * * * *'
push:
paths-ignore:
- doc/**
Expand Down Expand Up @@ -58,6 +58,7 @@ jobs:
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH_NAME=devel" >> $GITHUB_ENV
echo "LABELS= -DBUILD_WITH_COLLISION_SUPPORT=ON -DBUILD_WITH_CASADI_SUPPORT=ON -DBUILD_WITH_AUTODIFF_SUPPORT=ON -DBUILD_WITH_EXTRA_SUPPORT=ON -DBUILD_WITH_OPENMP_SUPPORT=ON -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON -DINSTALL_DOCUMENTATION=ON -DBUILD_WITH_CODEGEN_SUPPORT=ON -DGENERATE_PYTHON_STUBS=ON -DBUILD_WITH_ACCELERATE_SUPPORT=OFF -DBUILD_WITH_SDF_SUPPORT=ON" >> $GITHUB_ENV
else
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
fi
Expand Down Expand Up @@ -87,9 +88,12 @@ jobs:
if: (contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')) && contains(matrix.build_type, 'Debug')
run: |
echo "CMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/.github/workflows/cmake/linux-debug-toolchain.cmake" >> "$GITHUB_ENV"
- name: Get Compilation Flags
id: get_labels
uses: actions/github-script@v7
env:
LABELS: ${{ env.LABELS }}
with:
script: |
const script = require('./.github/workflows/scripts/get_compilation_flags.js');
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/get_compilation_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ module.exports = async ({github, context, core}) => {
}

// Get the GitHub event name that triggered the workflow
const eventName = process.env.GITHUB_EVENT_NAME;
if (eventName == "schedule")
const {LABELS} = process.env;
if (LABELS)
{
cmakeFlags += labelFlags['build_all'].join(' ');
cmakeFlags += LABELS;
console.log(cmakeFlags);
core.setOutput("cmakeFlags", cmakeFlags);
return;
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/windows-conda.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI - Windows via Conda
on:
schedule:
- cron: '0 0 * * 0'
- cron: '*/30 * * * *'
push:
paths-ignore:
- doc/**
Expand Down Expand Up @@ -45,14 +45,15 @@ jobs:
steps:
# Extract branch name or set 'devel' branch for scheduled events
- name: Get branch name or checkout devel
shell: pwsh # Use PowerShell on Windows
shell: bash
run: |
if ($env:GITHUB_EVENT_NAME -eq "schedule") {
echo "BRANCH_NAME=devel" >> $env:GITHUB_ENV
} else {
$branchName = $env:GITHUB_REF -replace '^refs/heads/', ''
echo "BRANCH_NAME=$branchName" >> $env:GITHUB_ENV
}
if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then
echo "BRANCH_NAME=devel" >> $GITHUB_ENV
echo "LABELS= -DBUILD_WITH_COLLISION_SUPPORT=ON -DBUILD_WITH_CASADI_SUPPORT=ON -DBUILD_WITH_AUTODIFF_SUPPORT=ON -DBUILD_WITH_EXTRA_SUPPORT=ON -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON -DINSTALL_DOCUMENTATION=ON -DGENERATE_PYTHON_STUBS=ON -DBUILD_WITH_ACCELERATE_SUPPORT=OFF -DBUILD_WITH_SDF_SUPPORT=ON" >> $GITHUB_ENV
else
branchName=${GITHUB_REF#refs/heads/}
echo "BRANCH_NAME=$branchName" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
with:
Expand All @@ -78,6 +79,8 @@ jobs:
id: get_labels
uses: actions/github-script@v7
with:
env:
LABELS: ${{ env.LABELS }}
script: |
const script = require('./.github/workflows/scripts/get_compilation_flags.js');
await script({github, context, core})
Expand Down

0 comments on commit f3ee4bb

Please sign in to comment.