Skip to content

Commit

Permalink
Merge pull request #2456 from MegMll/topic/weekly_ci
Browse files Browse the repository at this point in the history
Add a scheduled run on ci with build_all
  • Loading branch information
jorisv authored Oct 16, 2024
2 parents a846719 + f5ad345 commit 2e55c8b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 14 deletions.
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

0 comments on commit 2e55c8b

Please sign in to comment.