Skip to content

Commit

Permalink
switch react and vue workflows to github-build-matrix (#27676)
Browse files Browse the repository at this point in the history
* switch react and vue workflows to github-build-matrix

* Update .github/workflows/vue.yml

Co-authored-by: Daniel Franco <dandrfranco@gmail.com>

---------

Co-authored-by: Daniel Franco <dandrfranco@gmail.com>
  • Loading branch information
mshima and DanielFran authored Oct 24, 2024
1 parent d052119 commit f08d3d5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 36 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 'Build matrix'
id: build
uses: ./.github/actions/build-matrix
with:
workflow-samples-file: react
- run: npm ci --ignore-scripts
- id: build
run: bin/jhipster.cjs github-build-matrix react --event-name ${{ github.event_name }}
applications:
name: ${{ matrix.name }} (n${{ matrix.node }}/j${{ matrix.java }})
name: ${{ matrix.job-name }}
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
needs: build-matrix
defaults:
Expand All @@ -74,12 +72,12 @@ jobs:
!contains(github.event.pull_request.title, '[ci skip]') &&
github.event.action != 'closed' &&
!contains(github.event.pull_request.labels.*.name, 'pr: skip-ci') &&
needs.build-matrix.outputs.workflow-react == 'true'
fromJson(needs.build-matrix.outputs.matrix).include[0] != null
timeout-minutes: 50
strategy:
fail-fast: false
# Matrix available at https://github.com/jhipster/generator-jhipster/tree/main/test-integration/workflow-samples/
matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
#----------------------------------------------------------------------
# Install all tools and check configuration
Expand All @@ -91,8 +89,8 @@ jobs:
fetch-depth: 2
- uses: jhipster/actions/setup-runner@v0
with:
node-version: ${{ matrix.node }}
java-version: ${{ matrix.java }}
node-version: ${{ matrix.node-version }}
java-version: ${{ matrix.java-version }}
npm-version: ${{ matrix.npm-version }}
maven-cache: true
gradle-cache: ${{ matrix.gradle-cache }}
Expand All @@ -103,7 +101,7 @@ jobs:
- run: npm ci --ignore-scripts
working-directory: ${{ github.workspace }}/generator-jhipster
- name: 'GENERATION: project'
run: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
run: jhipster.cjs generate-sample ${{ matrix.sample }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
JHI_FOLDER_APP: ${{ github.workspace }}/app
JHIPSTER_DEPENDENCIES_VERSION: ${{ matrix.jhipster-bom-cicd-version }}
Expand All @@ -119,7 +117,7 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
with:
generator-path: generator-jhipster
cmd: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
cmd: jhipster.cjs generate-sample ${{ matrix.sample }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
# generate-sample uses JHI_FOLDER_APP to generate the application.
JHI_FOLDER_APP: ${{ github.workspace }}/base/app
Expand All @@ -134,13 +132,13 @@ jobs:
jhipster-bom-ref: ${{ matrix.jhipster-bom-branch }}
- name: 'TESTS: backend'
id: backend
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 'true' && needs.build-matrix.outputs.server != 'false'
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 'true'
run: npm run ci:backend:test
continue-on-error: ${{matrix.continue-on-backend-tests-error || false}}
timeout-minutes: 15
# Run npm install for workspaces only, as it is done in packaging for non-workspaces
- name: 'PREPARE: npm install'
if: matrix.workspaces == 'true' && steps.compare.outputs.equals != 'true'
if: steps.compare.outputs.equals != 'true' && matrix.workspaces == 'true'
run: npm install
timeout-minutes: 7
- name: 'TESTS: packaging'
Expand All @@ -150,7 +148,7 @@ jobs:
timeout-minutes: 12
- name: 'TESTS: frontend'
id: frontend
if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false'
if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true'
run: npm run ci:frontend:test
timeout-minutes: 15
- name: 'TESTS: Start docker compose containers for e2e tests'
Expand All @@ -166,7 +164,7 @@ jobs:
uses: actions/upload-artifact@v4
if: always() && (steps.backend.outcome == 'failure' || steps.e2e.outcome == 'failure' || steps.frontend.outcome == 'failure' || steps.packaging.outcome == 'failure')
with:
name: app-${{ matrix.name }}
name: app-${{ matrix.sample }}
include-hidden-files: true
path: |
${{ github.workspace }}/app/**/*
Expand All @@ -181,13 +179,13 @@ jobs:
uses: actions/upload-artifact@v4
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
name: log-${{ matrix.sample }}
path: ${{ github.workspace }}/app/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
name: screenshots-${{ matrix.sample }}
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
Expand Down
34 changes: 16 additions & 18 deletions .github/workflows/vue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 'Build matrix'
id: build
uses: ./.github/actions/build-matrix
with:
workflow-samples-file: vue
- run: npm ci --ignore-scripts
- id: build
run: bin/jhipster.cjs github-build-matrix vue --event-name ${{ github.event_name }}
applications:
name: ${{ matrix.name }} (n${{ matrix.node }}/j${{ matrix.java }})
name: ${{ matrix.job-name }}
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
needs: build-matrix
defaults:
Expand All @@ -74,12 +72,12 @@ jobs:
!contains(github.event.pull_request.title, '[ci skip]') &&
github.event.action != 'closed' &&
!contains(github.event.pull_request.labels.*.name, 'pr: skip-ci') &&
needs.build-matrix.outputs.workflow-vue == 'true'
fromJson(needs.build-matrix.outputs.matrix).include[0] != null
timeout-minutes: 50
strategy:
fail-fast: false
# Matrix available at https://github.com/jhipster/generator-jhipster/tree/main/test-integration/workflow-samples/
matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
#----------------------------------------------------------------------
# Install all tools and check configuration
Expand All @@ -91,8 +89,8 @@ jobs:
fetch-depth: 2
- uses: jhipster/actions/setup-runner@v0
with:
node-version: ${{ matrix.node }}
java-version: ${{ matrix.java }}
node-version: ${{ matrix.node-version }}
java-version: ${{ matrix.java-version }}
npm-version: ${{ matrix.npm-version }}
maven-cache: true
gradle-cache: ${{ matrix.gradle-cache }}
Expand All @@ -103,7 +101,7 @@ jobs:
- run: npm ci --ignore-scripts
working-directory: ${{ github.workspace }}/generator-jhipster
- name: 'GENERATION: project'
run: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
run: jhipster.cjs generate-sample ${{ matrix.sample }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
JHI_FOLDER_APP: ${{ github.workspace }}/app
JHIPSTER_DEPENDENCIES_VERSION: ${{ matrix.jhipster-bom-cicd-version }}
Expand All @@ -119,7 +117,7 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
with:
generator-path: generator-jhipster
cmd: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
cmd: jhipster.cjs generate-sample ${{ matrix.sample }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
# generate-sample uses JHI_FOLDER_APP to generate the application.
JHI_FOLDER_APP: ${{ github.workspace }}/base/app
Expand All @@ -134,13 +132,13 @@ jobs:
jhipster-bom-ref: ${{ matrix.jhipster-bom-branch }}
- name: 'TESTS: backend'
id: backend
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 'true' && needs.build-matrix.outputs.server != 'false'
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 'true'
run: npm run ci:backend:test
continue-on-error: ${{matrix.continue-on-backend-tests-error || false}}
timeout-minutes: 15
# Run npm install for workspaces only, as it is done in packaging for non-workspaces
- name: 'PREPARE: npm install'
if: matrix.workspaces == 'true' && steps.compare.outputs.equals != 'true'
if: steps.compare.outputs.equals != 'true' && matrix.workspaces == 'true'
run: npm install
timeout-minutes: 7
- name: 'TESTS: packaging'
Expand All @@ -150,7 +148,7 @@ jobs:
timeout-minutes: 12
- name: 'TESTS: frontend'
id: frontend
if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false'
if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true'
run: npm run ci:frontend:test
timeout-minutes: 15
- name: 'TESTS: Start docker compose containers for e2e tests'
Expand All @@ -166,7 +164,7 @@ jobs:
uses: actions/upload-artifact@v4
if: always() && (steps.backend.outcome == 'failure' || steps.e2e.outcome == 'failure' || steps.frontend.outcome == 'failure' || steps.packaging.outcome == 'failure')
with:
name: app-${{ matrix.name }}
name: app-${{ matrix.sample }}
include-hidden-files: true
path: |
${{ github.workspace }}/app/**/*
Expand All @@ -181,13 +179,13 @@ jobs:
uses: actions/upload-artifact@v4
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
name: log-${{ matrix.sample }}
path: ${{ github.workspace }}/app/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
name: screenshots-${{ matrix.sample }}
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
Expand Down

0 comments on commit f08d3d5

Please sign in to comment.