Skip to content

Commit

Permalink
use generate-sample at ios workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jun 6, 2024
1 parent 9bef6d5 commit c777c67
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class extends BaseGenerator {
get [BaseGenerator.LOADING]() {
return this.asLoadingTaskGroup({
async loadCommand() {
await this.loadCurrentJHipsterCommandConfig(undefined);
await this.loadCurrentJHipsterCommandConfig(this);
},
});
}
Expand Down
2 changes: 2 additions & 0 deletions .blueprint/generate-sample/templates/samples/21points-jwt.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ application {
authenticationType jwt
skipClient true
devDatabaseType h2Disk
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities *
}
Expand Down
2 changes: 2 additions & 0 deletions .blueprint/generate-sample/templates/samples/app-jwt.jdl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
application {
config {
authenticationType jwt
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
skipClient true
devDatabaseType h2Disk
}
Expand Down
2 changes: 2 additions & 0 deletions .blueprint/generate-sample/templates/samples/app-oauth2.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ application {
authenticationType oauth2
skipClient true
devDatabaseType h2Disk
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities *
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ application {
websocket spring-websocket
skipClient true
devDatabaseType h2Disk
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities *
}
Expand Down
2 changes: 2 additions & 0 deletions .blueprint/generate-sample/templates/samples/flickr2-jwt.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ application {
authenticationType jwt
skipClient true
devDatabaseType h2Disk
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities *
}
Expand Down
11 changes: 8 additions & 3 deletions .blueprint/github-build-matrix/build-matrix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ import { RECOMMENDED_JAVA_VERSION, RECOMMENDED_NODE_VERSION } from 'generator-jh
import { fromMatrix } from 'generator-jhipster/testing';

const defaultMatrix = {
os: ['macos-13'],
os: ['macos-14'],
'node-version': [RECOMMENDED_NODE_VERSION],
'java-version': [RECOMMENDED_JAVA_VERSION],
'default-environment': ['dev'],
};

const oauth2Sample = {
os: 'macos-14',
'default-environment': 'prod',
};

export const buildMatrix = async samplesFolder => {
const samples = await readdir(samplesFolder);
return {
include: Object.values(
fromMatrix({
...defaultMatrix,
...(samplesFolder === 'oauth2' ? oauth2Matrix : defaultMatrix),
'sample-name': samples.filter(sample => !sample.includes('disabled')),
}),
),
).map(sample => (sample['sample-name'].includes('oauth2') ? { ...sample, ...oauth2Sample } : sample)),
};
};
2 changes: 1 addition & 1 deletion .blueprint/github-build-matrix/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class extends BaseGenerator {
get [BaseGenerator.LOADING]() {
return this.asLoadingTaskGroup({
async loadCommand() {
await this.loadCurrentJHipsterCommandConfig(undefined);
await this.loadCurrentJHipsterCommandConfig(this);
},
});
}
Expand Down
124 changes: 49 additions & 75 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
name: iOS-E2E
on:
workflow_dispatch:
inputs:
recordVideo:
description: 'Record failing E2E Tests'
required: false
default: 'false'
screenshots:
description: 'Screenshot failing E2E Tests'
required: false
default: 'false'
push:
branches:
- 'main'
Expand All @@ -31,61 +21,40 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 20
- name: check-dependencies
run: |
cd generators/react-native/resources/expo
npm run check-dependencies
applications:
name: e2e-${{ matrix.app_type }}-${{ matrix.jhipster_version }}
runs-on: macos-14
build-matrix:
runs-on: ubuntu-latest
needs: [check-dependencies]
outputs:
matrix: ${{ steps.build.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- id: build
run: |
npm ci --ignore-scripts --omit=dev
cli/cli.cjs github-build-matrix
applications:
name: ${{ matrix.sample-name }}
runs-on: ${{ matrix.os }}
needs: build-matrix
timeout-minutes: 90
defaults:
run:
working-directory: ${{ github.workspace }}/client
strategy:
fail-fast: false
matrix:
jhipster_version: [8]
node_version: [20.x]
app_type:
- JwtDtoApp
- JwtWebsocketsApp
- JwtHealthPointsApp
- JwtFlickrApp
- OauthApp
include:
- app_type: JwtDtoApp
auth_type: jwt
dto: true
- app_type: JwtWebsocketsApp
auth_type: jwt
dto: false
websockets: true
- app_type: JwtHealthPointsApp
auth_type: jwt
dto: false
entity_jdl: entities-21points.jdl
- app_type: JwtFlickrApp
auth_type: jwt
dto: false
entity_jdl: entities-flickr2.jdl
- app_type: OauthApp
auth_type: oauth2
backend: 'false'
dto: false
matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
env:
JHI_REACT_NATIVE_APP_NAME: ${{ matrix.app_type }}
JHI_AUTH_TYPE: ${{ matrix.auth_type }}
JHI_DTO: ${{ matrix.dto }}
JHI_WEBSOCKETS: ${{ matrix.websockets }}
JHI_ENTITY_JDL: ${{ matrix.entity_jdl }}
JHIPSTER_VERSION: ${{ matrix.jhipster_version }}
SCRIPT_DIR: ${{ github.workspace }}/generator-jhipster-react-native/test/scripts
PLATFORM: ios
JHI_RECORD_VIDEO: ${{ github.event.inputs.recordVideo || 'false' }}
JHI_SCREENSHOTS: ${{ github.event.inputs.screenshots || 'false' }}
FORCE_COLOR: true
steps:
- uses: jhipster/actions/create-app-path@v0
Expand All @@ -96,8 +65,8 @@ jobs:
path: backend
- uses: jhipster/actions/setup-runner@v0
with:
node-version: 20
java-version: 17
node-version: ${{ matrix.node-version }}
java-version: ${{ matrix.java-version }}
maven-cache: true
binary-dir: ${{ github.workspace }}/generator-jhipster-react-native/cli
- uses: actions/checkout@v4
Expand All @@ -112,55 +81,60 @@ jobs:
with:
max_attempts: 3
timeout_minutes: 60
command: $SCRIPT_DIR/install-detox.sh
command: brew tap wix/brew && brew install applesimutils
retry_wait_seconds: 15
- run: $SCRIPT_DIR/display-tools.sh
name: 'TOOLS: display tools'
- run: npm i
name: 'TOOLS: npm install in generator-jhipster-react-native'
working-directory: ${{ github.workspace }}/generator-jhipster-react-native
- run: $SCRIPT_DIR/copy-jdl-file.sh
name: 'SETUP: copy the JDL file for the backend and app'
- run: npm install
working-directory: ${{ github.workspace }}/generator-jhipster-react-native
- run: cli.cjs jdl ../${JHI_REACT_NATIVE_APP_NAME}.jdl --force --skip-checks --skip-commit-hook --no-insight --skip-install --disable-blueprints
name: 'GENERATING: generate jhipster backend'
- run: cli.cjs generate-sample ${{ matrix.sample-name }} --force --skip-commit-hook
working-directory: ${{ github.workspace }}/backend
- run: cli.cjs --force --skip-install
name: 'GENERATING: generate react-native app'
- uses: jhipster/actions/compare-sample@v0
continue-on-error: true
id: compare-backend
if: >-
github.event.pull_request &&
contains(github.event.pull_request.labels.*.name, 'pr: compare-backend')
with:
application-base-path: ${{ github.workspace }}/backend-base
application-folder: backend
compare-folder: backend
generator-path: generator-jhipster-react-native
cmd: cli.cjs generate-sample ${{ matrix.sample-name }} --force --skip-git --skip-commit-hook
- uses: jhipster/actions/compare-sample@v0
id: compare
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare') &&
steps.compare-backend.outputs.has-changes != 'true'
with:
application-folder: backend
compare-folder: client
generator-path: generator-jhipster-react-native
application-base-path: ${{ github.workspace }}/client-base
current-application-base-path: ${{ github.workspace }}/client
application-folder: .
compare-folder: .
cmd: cli.cjs --force --skip-install
cmd: cli.cjs generate-sample ${{ matrix.sample-name }} --force --skip-git --skip-commit-hook
- run: npm install
if: steps.compare.outputs.equals != 'true'
- run: npx expo prebuild -p ios
- run: git add . && git diff
if: steps.compare.outputs.equals != 'true'
- run: npm run e2e:build:ios
if: steps.compare.outputs.equals != 'true'
- run: |
npm run app:start &
npm install -g wait-on
wait-on -t 60000 http-get://127.0.0.1:8080/management/health
if: matrix.backend != 'false'
if: matrix.default-environment != 'prod' && steps.compare.outputs.equals != 'true'
working-directory: ${{ github.workspace }}/backend
- run: npm run e2e:test:ios
if: steps.compare.outputs.equals != 'true'
- uses: actions/upload-artifact@v4
if: ${{ always() }}
if: steps.compare.outputs.equals != 'true' && always()
with:
name: expo-app-${{ matrix.app_type }}-${{ matrix.jhipster_version }}
name: expo-app-${{ matrix.sample-name }}
path: |
${{ github.workspace }}/client/
!${{ github.workspace }}/**/android
!${{ github.workspace }}/**/ios
!${{ github.workspace }}/**/node_modules
ios-result:
permissions:
contents: none
Expand Down

0 comments on commit c777c67

Please sign in to comment.