|
| 1 | +# Copyright (c) 2023 Robert Bosch GmbH |
| 2 | +# |
| 3 | +# This program and the accompanying materials are made available under the |
| 4 | +# terms of the Apache License, Version 2.0 which is available at |
| 5 | +# https://www.apache.org/licenses/LICENSE-2.0. |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | +# |
| 13 | +# SPDX-License-Identifier: Apache-2.0 |
| 14 | + |
| 15 | +name: Project creation |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.ref }}-project-creation |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +on: |
| 22 | + workflow_dispatch: |
| 23 | + push: |
| 24 | + # Run only on branches/commits and not tags |
| 25 | + branches: |
| 26 | + - main |
| 27 | + pull_request: |
| 28 | + branches: |
| 29 | + - main |
| 30 | + |
| 31 | +jobs: |
| 32 | + check-project-creation: |
| 33 | + name: Check project creation |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + example: ["no-example", "seat-adjuster"] |
| 38 | + fail-fast: false |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/setup-node@v3 |
| 42 | + with: |
| 43 | + node-version: latest |
| 44 | + |
| 45 | + - name: Checkout CLI |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + repository: eclipse-velocitas/cli |
| 49 | + path: cli |
| 50 | + ref: v0.6.3 |
| 51 | + |
| 52 | + - name: Checkout SDK repo |
| 53 | + uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + path: sdk |
| 56 | + |
| 57 | + - name: Install CLI |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + cd cli |
| 61 | + npm i && npm run build && npx oclif manifest && npm i -g . |
| 62 | +
|
| 63 | + - name: Create project |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + git config --global user.name "Git User" |
| 67 | + git config --global user.email "[email protected]" |
| 68 | +
|
| 69 | + # overwrite SDK path in order to use scripts from this branch (rather than sdk/main) |
| 70 | + export VELOCITAS_SDK_PATH_OVERRIDE=$(pwd)/sdk |
| 71 | +
|
| 72 | + mkdir app |
| 73 | + cd app |
| 74 | +
|
| 75 | + # show available commands and version of CLI |
| 76 | + velocitas |
| 77 | +
|
| 78 | + # copy "full" package-index.json from CLI repo |
| 79 | + cp ../cli/testbench/test-create/vehicle-app-template/package-index.json ./package-index.json |
| 80 | + CREATE_ARGS="-n MyApp" |
| 81 | + if [ "${{ matrix.example }}" != "no-example" ]; then |
| 82 | + CREATE_ARGS="-e ${{ matrix.example }}" |
| 83 | + fi |
| 84 | + velocitas create -l python $CREATE_ARGS |
| 85 | +
|
| 86 | + - name: Install dependencies |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + pip install -r ./sdk/.project-creation/test/requirements.txt |
| 90 | +
|
| 91 | + - name: Run verification on generated project |
| 92 | + shell: bash |
| 93 | + run: | |
| 94 | + export VELOCITAS_SDK_ROOT=./sdk |
| 95 | + export VELOCITAS_APP_ROOT=./app |
| 96 | +
|
| 97 | + # debug print contents |
| 98 | + ls -al $VELOCITAS_APP_ROOT |
| 99 | +
|
| 100 | + pytest --ignore-glob=**/.devcontainer/* --ignore-glob=**/.skeleton/* ./sdk/.project-creation |
| 101 | +
|
| 102 | + - name: Check if devContainer starts up properly and app is usable |
| 103 | + uses: devcontainers/[email protected] |
| 104 | + with: |
| 105 | + subFolder: ./app |
| 106 | + runCmd: | |
| 107 | + git init && \ |
| 108 | + pre-commit run --all-files && \ |
| 109 | + pip3 install -r .devcontainer/tests/automated_tests/requirements.txt && \ |
| 110 | + cat app/AppManifest.json && \ |
| 111 | + velocitas exec grpc-interface-support generate-sdk && \ |
| 112 | + pytest -sx .devcontainer/tests/automated_tests |
| 113 | +
|
| 114 | + - name: Upload logs |
| 115 | + uses: actions/upload-artifact@v3 |
| 116 | + if: always() |
| 117 | + with: |
| 118 | + name: logs_${{ matrix.example }} |
| 119 | + path: ./app/logs |
| 120 | + retention-days: 1 |
0 commit comments