Skip to content

Commit

Permalink
Centralize shared vars for different Github actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gmunozfe committed Oct 21, 2024
1 parent 1474ab9 commit f9337f3
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 13 deletions.
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: 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
9 changes: 7 additions & 2 deletions .github/workflows/pr-backporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
shared-vars:
uses: 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,7 +67,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
runs-on: ${{ needs.shared-vars.outputs.os }}
needs: shared-vars
needs: compute-targets
strategy:
matrix:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/pr-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ jobs:
group: pr-${{ matrix.job_name }}_${{ matrix.os }}_${{ matrix.java-version }}_${{ matrix.maven-version }}_${{ github.head_ref }}
cancel-in-progress: true
timeout-minutes: 180
uses: shared-vars.yml
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 }}]
include:
- job_name: kogito-apps
repository: incubator-kie-kogito-apps
Expand All @@ -62,7 +63,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: ${{ matrix.os contains('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: 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
9 changes: 5 additions & 4 deletions .github/workflows/pr-kogito-runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ jobs:
group: pr-kogito-runtimes_${{ matrix.os }}_${{ matrix.java-version }}_${{ matrix.maven-version }}_${{ github.head_ref }}
cancel-in-progress: true
timeout-minutes: 120
uses: shared-vars.yml
strategy:
matrix:
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 }}]
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: ${{ matrix.os contains('ubuntu') }}
- name: Support long paths
if: ${{ matrix.os == 'windows-latest' }}
uses: apache/incubator-kie-kogito-pipelines/.ci/actions/long-paths@main
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/shared-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# 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'

0 comments on commit f9337f3

Please sign in to comment.