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

[incubator-kie-issues-1553] Centralize shared vars for different Github actions workflows #3742

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 7 additions & 23 deletions .github/workflows/pr-backporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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) }}
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/pr-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,50 @@ 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']
job_name: [kogito-apps, kogito-quarkus-examples, kogito-springboot-examples, serverless-workflow-examples]
include:
- job_name: kogito-apps
repository: incubator-kie-kogito-apps
env_BUILD_MVN_OPTS: "-DskipUI"
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-quarkus-examples
repository: incubator-kie-kogito-examples
env_KOGITO_EXAMPLES_SUBFOLDER_POM: kogito-quarkus-examples/
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-springboot-examples
repository: incubator-kie-kogito-examples
env_KOGITO_EXAMPLES_SUBFOLDER_POM: kogito-springboot-examples/
os: ${{ needs.shared-vars.outputs.os }}
java-version: ${{ needs.shared-vars.outputs.java-version }}
maven-version: ${{ needs.shared-vars.outputs.maven-version }}
- job_name: serverless-workflow-examples
repository: incubator-kie-kogito-examples
env_KOGITO_EXAMPLES_SUBFOLDER_POM: serverless-workflow-examples/
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.job_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: ${{ contains(matrix.os, 'ubuntu') }}
- name: Support long paths
if: ${{ matrix.os == 'windows-latest' }}
uses: apache/incubator-kie-kogito-pipelines/.ci/actions/long-paths@main
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pr-jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/pr-kogito-runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
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
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/shared-vars.yml
Original file line number Diff line number Diff line change
@@ -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."
Loading