Project creation #391
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation | |
# | |
# This program and the accompanying materials are made available under the | |
# terms of the Apache License, Version 2.0 which is available at | |
# https://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. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Project creation | |
concurrency: | |
group: ${{ github.ref }}-project-creation | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
# Run only on branches/commits and not tags | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Scheduled build to fetch regressions, if any | |
schedule: | |
- cron: "0 4 * * *" | |
jobs: | |
check-project-creation: | |
name: Check project creation | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
example: ["no-example", "seat-adjuster"] | |
fail-fast: false | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Checkout CLI | |
uses: actions/checkout@v4 | |
with: | |
repository: eclipse-velocitas/cli | |
path: cli | |
ref: v0.11.0 | |
- name: Checkout SDK repo | |
uses: actions/checkout@v4 | |
with: | |
path: sdk | |
- name: Install CLI | |
shell: bash | |
run: | | |
cd cli | |
npm i && npm run build && npx oclif manifest && npm i -g . | |
- name: Checkout vehicle-app-template | |
uses: actions/checkout@v4 | |
with: | |
repository: eclipse-velocitas/vehicle-app-template | |
path: vehicle-app-template | |
ref: main | |
- name: Create project | |
shell: bash | |
run: | | |
git config --global user.name "Git User" | |
git config --global user.email "[email protected]" | |
# overwrite SDK path in order to use scripts from this branch (rather than sdk/main) | |
export VELOCITAS_SDK_PATH_OVERRIDE=$(pwd)/sdk | |
mkdir app | |
cd app | |
# show available commands and version of CLI | |
velocitas | |
# copy "full" package-index.json from CLI repo | |
cp ../vehicle-app-template/package-index.json ./package-index.json | |
CREATE_ARGS="-n MyApp" | |
if [ "${{ matrix.example }}" != "no-example" ]; then | |
CREATE_ARGS="-e ${{ matrix.example }}" | |
fi | |
velocitas create -c vapp-core-python $CREATE_ARGS | |
# Velocitas CLI fetches an older merged/released version of the example | |
# But we want to check the one in this repository so lets copy it | |
if [ "${{ matrix.example }}" != "no-example" ]; then | |
cp -r ../sdk/examples/${{ matrix.example }}/* ../app/app | |
fi | |
- name: Install dependencies | |
shell: bash | |
run: | | |
pip install -r ./sdk/.project-creation/test/requirements.txt | |
- name: Run verification on generated project | |
shell: bash | |
run: | | |
export VELOCITAS_SDK_ROOT=./sdk | |
export VELOCITAS_APP_ROOT=./app | |
# debug print contents | |
ls -al $VELOCITAS_APP_ROOT | |
pytest --ignore-glob=**/.devcontainer/* --ignore-glob=**/.skeleton/* ./sdk/.project-creation | |
- name: Check if devContainer starts up properly and app is usable | |
uses: devcontainers/[email protected] | |
with: | |
subFolder: ./app | |
runCmd: | | |
git init && \ | |
pre-commit run --all-files && \ | |
pip3 install -r .devcontainer/tests/automated_tests/requirements.txt && \ | |
cat app/AppManifest.json && \ | |
pytest -sx .devcontainer/tests/automated_tests | |
- name: Upload logs | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: logs_${{ matrix.example }} | |
path: ./app/logs | |
retention-days: 1 |