diff --git a/.github/workflows/macos-linux-conda.yml b/.github/workflows/macos-linux-conda.yml index 0f158024bf..b14fa92fdd 100644 --- a/.github/workflows/macos-linux-conda.yml +++ b/.github/workflows/macos-linux-conda.yml @@ -1,6 +1,8 @@ name: CI - OSX/Linux via Conda on: + schedule: + - cron: '0 0 * * 1' push: paths-ignore: - doc/** @@ -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 @@ -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'); diff --git a/.github/workflows/scripts/get_compilation_flags.js b/.github/workflows/scripts/get_compilation_flags.js index 2eb0f044e4..75e46d9b68 100644 --- a/.github/workflows/scripts/get_compilation_flags.js +++ b/.github/workflows/scripts/get_compilation_flags.js @@ -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") { @@ -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])) { diff --git a/.github/workflows/windows-conda.yml b/.github/workflows/windows-conda.yml index 46c2c98855..85469f9306 100644 --- a/.github/workflows/windows-conda.yml +++ b/.github/workflows/windows-conda.yml @@ -1,5 +1,7 @@ name: CI - Windows via Conda on: + schedule: + - cron: '0 0 * * 1' push: paths-ignore: - doc/** @@ -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 @@ -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');