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

Add a scheduled run on ci with build_all #2456

Merged
merged 14 commits into from
Oct 16, 2024
16 changes: 16 additions & 0 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: CI - OSX/Linux via Conda

on:
schedule:
- cron: '0 0 * * 1'
push:
paths-ignore:
- doc/**
Expand Down Expand Up @@ -51,8 +53,19 @@ jobs:
BUILD_ADVANCED_TESTING: OFF

steps:
# extract branch name or checkout devel branch for scheduled events
- name: Get branch name or checkout devel
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH_NAME=devel" >> $GITHUB_ENV
echo "LABELS=build_all" >> $GITHUB_ENV
else
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
fi

- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
submodules: recursive

- uses: actions/cache@v4
Expand All @@ -74,9 +87,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
38 changes: 24 additions & 14 deletions .github/workflows/scripts/get_compilation_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,8 @@ module.exports = async ({github, context, core}) => {
const prNumber = context.issue.number || getPullRequestNumber(context.ref);

let cmakeFlags = '';
if(isNaN(prNumber))
{
core.setOutput("cmakeFlags", cmakeFlags);
return;
}

const { data } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
const labelNames = data.labels.map(label => label.name);

// get os process is run on
const os = process.env.RUNNER_OS;

var labelFlags;
if(os == "Windows")
{
Expand Down Expand Up @@ -77,6 +64,29 @@ module.exports = async ({github, context, core}) => {
};
}

// Get the GitHub event name that triggered the workflow
const {LABELS} = process.env;
var labelNames;
if(LABELS)
{
labelNames=[LABELS];
}
else
{
if(isNaN(prNumber))
{
core.setOutput("cmakeFlags", cmakeFlags);
return;
}

const { data } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
labelNames = data.labels.map(label => label.name);
}

labelNames.forEach(label => {
if (labelFlags[label]) {
if (Array.isArray(labelFlags[label])) {
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/windows-conda.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CI - Windows via Conda
on:
schedule:
- cron: '0 0 * * 1'
push:
paths-ignore:
- doc/**
Expand Down Expand Up @@ -41,8 +43,21 @@ jobs:
compiler: [cl, clang-cl]

steps:
# Extract branch name or set 'devel' branch for scheduled events
- name: Get branch name or checkout devel
shell: bash
run: |
if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then
echo "BRANCH_NAME=devel" >> $GITHUB_ENV
echo "LABELS=build_all" >> $GITHUB_ENV
else
branchName=${GITHUB_REF#refs/heads/}
echo "BRANCH_NAME=$branchName" >> $GITHUB_ENV
fi

- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
submodules: recursive

- uses: actions/cache@v4
Expand All @@ -63,6 +78,8 @@ jobs:
- 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
Loading