diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 6779e30d9dd..96cc5b5d553 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -23,8 +23,12 @@ on: issues: types: [opened, reopened] jobs: + shared-vars: + uses: ./.github/workflows/shared-vars.yml + message: - runs-on: ubuntu-latest + runs-on: ${{ needs.shared-vars.outputs.os }} + needs: shared-vars steps: - uses: actions/checkout@v4 - name: Send a stream message diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml index 88b297512e8..7a91cd5eb4a 100644 --- a/.github/workflows/pr-backporting.yml +++ b/.github/workflows/pr-backporting.yml @@ -17,26 +17,6 @@ # under the License. # - -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - name: Pull Request Backporting on: @@ -46,9 +26,13 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + shared-vars: + uses: ./.github/workflows/shared-vars.yml + compute-targets: if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged }} - runs-on: ubuntu-latest + runs-on: ${{ needs.shared-vars.outputs.os }} + needs: shared-vars outputs: target-branches: ${{ steps.set-targets.outputs.targets }} env: @@ -63,8 +47,8 @@ jobs: backporting: if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged && needs.compute-targets.outputs.target-branches != '[]' }} name: "[${{ matrix.target-branch }}] - Backporting" - runs-on: ubuntu-latest - needs: compute-targets + runs-on: ${{ needs.shared-vars.outputs.os }} + needs: [shared-vars, compute-targets] strategy: matrix: target-branch: ${{ fromJSON(needs.compute-targets.outputs.target-branches) }} diff --git a/.github/workflows/pr-downstream.yml b/.github/workflows/pr-downstream.yml index 66f99718375..a7067953106 100644 --- a/.github/workflows/pr-downstream.yml +++ b/.github/workflows/pr-downstream.yml @@ -32,17 +32,21 @@ on: - '.ci/jenkins/**' jobs: + shared-vars: + uses: ./.github/workflows/shared-vars.yml + kogito-downstream-build: + needs: shared-vars concurrency: group: pr-${{ matrix.job_name }}_${{ matrix.os }}_${{ matrix.java-version }}_${{ matrix.maven-version }}_${{ github.head_ref }} cancel-in-progress: true timeout-minutes: 180 strategy: matrix: - job_name: [ kogito-apps, kogito-quarkus-examples, kogito-springboot-examples, serverless-workflow-examples ] - os: [ubuntu-latest] - java-version: [17] - maven-version: ['3.9.6'] + os: [${{ needs.shared-vars.outputs.os }}] + java-version: [${{ needs.shared-vars.outputs.java-version }}] + maven-version: [${{ needs.shared-vars.outputs.maven-version }}] + job_name: [kogito-apps, kogito-quarkus-examples, kogito-springboot-examples, serverless-workflow-examples] include: - job_name: kogito-apps repository: incubator-kie-kogito-apps @@ -62,7 +66,7 @@ jobs: steps: - name: Clean Disk Space uses: apache/incubator-kie-kogito-pipelines/.ci/actions/ubuntu-disk-space@main - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ contains(matrix.os, 'ubuntu') }} - name: Support long paths if: ${{ matrix.os == 'windows-latest' }} uses: apache/incubator-kie-kogito-pipelines/.ci/actions/long-paths@main diff --git a/.github/workflows/pr-jenkins.yml b/.github/workflows/pr-jenkins.yml index 9b81584a389..bad948c0274 100644 --- a/.github/workflows/pr-jenkins.yml +++ b/.github/workflows/pr-jenkins.yml @@ -29,11 +29,15 @@ on: - '.github/workflows/jenkins-tests-PR.yml' jobs: + shared-vars: + uses: ./.github/workflows/shared-vars.yml + jenkinsfile-tests: concurrency: group: ${{ github.repository.name }}_jenkinsfile_tests-${{ github.head_ref }} cancel-in-progress: true - runs-on: ubuntu-latest + runs-on: ${{ needs.shared-vars.outputs.os }} + needs: shared-vars name: Jenkinsfiles steps: - name: Checkout repo @@ -64,7 +68,8 @@ jobs: concurrency: group: ${{ github.repository.name }}_dsl_tests-${{ github.head_ref }} cancel-in-progress: true - runs-on: ubuntu-latest + runs-on: ${{ needs.shared-vars.outputs.os }} + needs: shared-vars name: DSL steps: - name: DSL tests diff --git a/.github/workflows/pr-kogito-runtimes.yml b/.github/workflows/pr-kogito-runtimes.yml index 47f96638227..967a9faf647 100644 --- a/.github/workflows/pr-kogito-runtimes.yml +++ b/.github/workflows/pr-kogito-runtimes.yml @@ -32,23 +32,28 @@ on: - '.ci/jenkins/**' jobs: + shared-vars: + uses: ./.github/workflows/shared-vars.yml + runtime-build: + needs: shared-vars concurrency: group: pr-kogito-runtimes_${{ matrix.os }}_${{ matrix.java-version }}_${{ matrix.maven-version }}_${{ github.head_ref }} cancel-in-progress: true timeout-minutes: 120 strategy: matrix: - os: [ubuntu-latest] - java-version: [17] - maven-version: ['3.9.6'] + include: + - os: ${{ needs.shared-vars.outputs.os }} + java-version: ${{ needs.shared-vars.outputs.java-version }} + maven-version: ${{ needs.shared-vars.outputs.maven-version }} fail-fast: false runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }} + name: (${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }}) steps: - name: Clean Disk Space uses: apache/incubator-kie-kogito-pipelines/.ci/actions/ubuntu-disk-space@main - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ startsWith(matrix.os, 'ubuntu') }} - name: Support long paths if: ${{ matrix.os == 'windows-latest' }} uses: apache/incubator-kie-kogito-pipelines/.ci/actions/long-paths@main @@ -64,7 +69,7 @@ jobs: annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }} github-token: "${{ secrets.GITHUB_TOKEN }}" definition-file: https://raw.githubusercontent.com/${GROUP:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/pull-request-config.yaml - env: + env: BUILD_MVN_OPTS_CURRENT: '-Dvalidate-formatting' - name: Junit Report uses: apache/incubator-kie-kogito-pipelines/.ci/actions/action-junit-report@main diff --git a/.github/workflows/shared-vars.yml b/.github/workflows/shared-vars.yml new file mode 100644 index 00000000000..dcddb7135a7 --- /dev/null +++ b/.github/workflows/shared-vars.yml @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: 'Shared Variables to be reused in different workflows' + +on: + workflow_call: + outputs: + os: + description: 'OS to use' + value: 'ubuntu-22.04' + java-version: + description: 'Java version to use' + value: '17' + maven-version: + description: 'Maven version to use' + value: '3.9.6' + +jobs: + set-variables: + runs-on: ubuntu-latest + steps: + - name: Set variables + run: echo "This job is set common variables for other workflows."