Skip to content

Commit

Permalink
Build matrix (#16474)
Browse files Browse the repository at this point in the history
* Split build-matrix

* Fix build-matrix any output
  • Loading branch information
mshima authored Sep 28, 2021
1 parent 6109bed commit 6a7c976
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
55 changes: 37 additions & 18 deletions .github/actions/build-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,36 @@ inputs:
outputs:
matrix:
description: 'Build Matrix'
value: ${{ steps.build.outputs.matrix }}
value: ${{ steps.build-matrix.outputs.matrix }}
skip-workflow:
description: 'Skip workflow'
value: ${{ inputs.skip-workflow }}
client:
description: 'Client files has changed'
value: ${{ steps.build.outputs.client }}
value: ${{ steps.build-changes.outputs.client }}
common:
description: 'Common files has changed'
value: ${{ steps.build.outputs.common }}
value: ${{ steps.build-changes.outputs.common }}
server:
description: 'Server files has changed'
value: ${{ steps.build.outputs.server }}
value: ${{ steps.build-changes.outputs.server }}
workspaces:
description: 'Workspaces files has changed'
value: ${{ steps.build.outputs.workspaces }}
value: ${{ steps.build-changes.outputs.workspaces }}
e2e:
description: 'E2E files has changed'
value: ${{ steps.build.outputs.e2e }}
value: ${{ steps.build-changes.outputs.e2e }}
any:
description: 'Any files has changed'
value: ${{ steps.build.outputs.any }}
value: ${{ steps.build-changes.outputs.any }}
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v2.4.0
with:
node-version: 14
- name: 'Check changes'
id: build
id: build-changes
run: |
CLIENT=false
SERVER=false
Expand All @@ -77,6 +77,11 @@ runs:
E2E=false
ANY=false
if [[ "true" == "${{inputs.skip-workflow}}" ]]; then
echo "::set-output name=angular::false"
echo "::set-output name=react::false"
echo "::set-output name=vue::false"
echo "::set-output name=client-common::false"
echo "::set-output name=client::${CLIENT}"
echo "::set-output name=server::${SERVER}"
echo "::set-output name=common::${COMMON}"
Expand All @@ -88,6 +93,11 @@ runs:
fi
if [[ "true" == "${{github.event.pull_request || 'true'}}" ]]; then
echo "::set-output name=angular::true"
echo "::set-output name=react::true"
echo "::set-output name=vue::true"
echo "::set-output name=client-common::true"
echo "::set-output name=client::true"
echo "::set-output name=server::true"
echo "::set-output name=common::true"
Expand Down Expand Up @@ -176,36 +186,45 @@ runs:
|| WORKSPACES=true E2E=true ANY=true
echo "::endgroup::"
echo "::set-output name=angular::${ANGULAR}"
echo "::set-output name=react::${REACT}"
echo "::set-output name=vue::${VUE}"
echo "::set-output name=client-common::${CLIENT_COMMON}"
echo "::set-output name=client::${CLIENT}"
echo "::set-output name=server::${SERVER}"
echo "::set-output name=common::${COMMON}"
echo "::set-output name=workspaces::${WORKSPACES}"
echo "::set-output name=e2e::${E2E}"
echo "::set-output name=any::${ANY}"
shell: bash

- name: 'Build matrix'
id: build-matrix
run: |
echo '{ "include" : [] }' > matrix.json
if [[ "true" == "$ANGULAR" || "true" == "$CLIENT_COMMON" ]]; then
if [[ "true" == "${{ steps.build-changes.outputs.angular }}" || "true" == "${{ steps.build-changes.outputs.client-common }}" ]]; then
echo "::group::Workflows Angular"
test-integration/scripts/99-print-matrix.js generators/client/__workflow/${{ inputs.workflow-file-prefix }}-angular.json
cat matrix.json
echo "::endgroup::"
fi
if [[ "true" == "$REACT" || "true" == "$CLIENT_COMMON" ]]; then
if [[ "true" == "${{ steps.build-changes.outputs.react }}" || "true" == "${{ steps.build-changes.outputs.client-common }}" ]]; then
echo "::group::Workflows React"
test-integration/scripts/99-print-matrix.js generators/client/__workflow/${{ inputs.workflow-file-prefix }}-react.json
cat matrix.json
echo "::endgroup::"
fi
if [[ "true" == "$VUE" || "true" == "$CLIENT_COMMON" ]]; then
if [[ "true" == "${{ steps.build-changes.outputs.vue }}" || "true" == "${{ steps.build-changes.outputs.client-common }}" ]]; then
echo "::group::Workflows Vue"
test-integration/scripts/99-print-matrix.js generators/client/__workflow/${{ inputs.workflow-file-prefix }}-vue.json
cat matrix.json
echo "::endgroup::"
fi
echo "::set-output name=client::${CLIENT}"
echo "::set-output name=server::${SERVER}"
echo "::set-output name=common::${COMMON}"
echo "::set-output name=workspaces::${WORKSPACES}"
echo "::set-output name=e2e::${E2E}"
echo "::set-output name=any::${ANY}"
MATRIX=$(cat matrix.json)
rm matrix.json
MATRIX="${MATRIX//'%'/'%25'}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
any: ${{ steps.build.outputs.any }}
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2.3.4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/jdl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
any: ${{ steps.build.outputs.any }}
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2.3.4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
any: ${{ steps.build.outputs.any }}
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2.3.4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
any: ${{ steps.build.outputs.any }}
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2.3.4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/webflux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
any: ${{ steps.build.outputs.any }}
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2.3.4
Expand Down

0 comments on commit 6a7c976

Please sign in to comment.