From 0531e7aae3cffd683ea3a4a0f66555ff37b92e11 Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Mon, 16 Sep 2024 13:06:40 +0200 Subject: [PATCH] Remove VERSION and add install script and release action Signed-off-by: Erik Jaegervall --- .github/workflows/buildcheck.yml | 41 +++++++++++--- .github/workflows/create_draft_release.yml | 64 ++++++++++++++++++++++ Makefile | 40 +++++++------- VERSION | 1 - scripts/install_vss_tools.sh | 35 ++++++++++++ 5 files changed, 152 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/create_draft_release.yml delete mode 100644 VERSION create mode 100755 scripts/install_vss_tools.sh diff --git a/.github/workflows/buildcheck.yml b/.github/workflows/buildcheck.yml index aa639255f..8a8fce92e 100644 --- a/.github/workflows/buildcheck.yml +++ b/.github/workflows/buildcheck.yml @@ -4,6 +4,15 @@ on: push: pull_request: workflow_dispatch: + inputs: + vss-version: + required: false + type: string + workflow_call: + inputs: + vss-version: + required: false + type: string jobs: buildtest: @@ -20,20 +29,38 @@ jobs: python -V python -m pip --quiet --no-input install --upgrade pip python -m pip --quiet --no-input install --upgrade wheel - pip install pytest - # idlc currently used both during python test and later in this script - pip install cyclonedds - pip install git+https://github.com/COVESA/vss-tools@master - sudo apt install -y protobuf-compiler + ./scripts/install_vss_tools.sh echo done! - name: Test mandatory targets run: | + if "${{ inputs.vss-version }}" != ""; then + export VSS_VERSION="${{ inputs.vss-version }}" + fi make mandatory_targets + - name: "Uploading artifacts" + uses: actions/upload-artifact@v4 + with: + name: vss-artifacts + # Listing all artifacts that shall be managed as release artifacts + path: | + vss.csv + vss.fidl + vss.grapql.ts + vss.idl + vss.json + vss.jsonschema + vss.yaml + vss_noexpand.json + vss_samm.tar.gz + vss_apigear.tar.gz + if-no-files-found: error + - name: Test that ddsidl is correct run: | - idlc vss_rel_*.idl + pip install cyclonedds + idlc vss*.idl - name: Prepare for CSV check @@ -46,7 +73,7 @@ jobs: run: | # Install csvlint to check compliance with https://datatracker.ietf.org/doc/html/rfc4180 go install github.com/Clever/csvlint/cmd/csvlint@latest - csvlint vss_rel_*.csv + csvlint vss*.csv - name: Test optional targets. NOTE - always succeeds run: | diff --git a/.github/workflows/create_draft_release.yml b/.github/workflows/create_draft_release.yml new file mode 100644 index 000000000..b73ea1e90 --- /dev/null +++ b/.github/workflows/create_draft_release.yml @@ -0,0 +1,64 @@ +# /******************************************************************************** +# * Copyright (c) 2024 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ + +name: Create Draft Release + +on: + workflow_dispatch: # input version manually. Overrides push tag + inputs: + vss-version: + description: "Release version (numerical version), e.g. 4.2, 4.2rc0" + required: true + default: "0.0.0" + +# Needed if GITHUB_TOKEN by default do not have right to create release +permissions: + contents: write + packages: write + +jobs: + call_kuksa_databroker_build: + uses: ./.github/workflows/buildcheck.yml + with: + vss-version: ${{ inputs.vss-version }} + + create_release: + runs-on: ubuntu-latest + needs: + [ + call_kuksa_databroker_build + ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: build-artifacts + merge-multiple: true + - name: Display structure of downloaded files + run: | + ls -R build-artifacts + + - name: Create release + id: create_release + uses: softprops/action-gh-release@v2 + with: + draft: true + tag_name: "v${{ inputs.vss-version }}" + fail_on_unmatched_files: true + files: | + build-artifacts/* + spec/units.yaml + spec/quantities.yaml diff --git a/Makefile b/Makefile index c784accd4..dadd0a207 100644 --- a/Makefile +++ b/Makefile @@ -19,64 +19,62 @@ mandatory_targets: clean json json-noexpand franca yaml binary csv graphql ddsid optional_targets: clean protobuf ttl binary TOOLSDIR?=./vss-tools +VSS_VERSION ?= 0.0 COMMON_ARGS=-u ./spec/units.yaml --strict COMMON_VSPEC_ARG=-s ./spec/VehicleSignalSpecification.vspec json: - vspec export json ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).json + vspec export json ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.json json-noexpand: - vspec export json ${COMMON_ARGS} --no-expand ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION)_noexpand.json + vspec export json ${COMMON_ARGS} --no-expand ${COMMON_VSPEC_ARG} -o vss_noexpand.json jsonschema: - vspec export jsonschema ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).jsonschema + vspec export jsonschema ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.jsonschema franca: - vspec export franca --franca-vss-version $$(cat VERSION) ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).fidl + vspec export franca --franca-vss-version $(VSS_VERSION) ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.fidl yaml: - vspec export yaml ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).yaml + vspec export yaml ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.yaml csv: - vspec export csv ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).csv + vspec export csv ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.csv ddsidl: - vspec export ddsidl ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).idl + vspec export ddsidl ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.idl # Verifies that supported overlay combinations are syntactically correct. overlays: - vspec export json ${COMMON_ARGS} -l overlays/profiles/motorbike.vspec ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION)_motorbike.json - vspec export json ${COMMON_ARGS} -l overlays/extensions/dual_wiper_systems.vspec ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION)_dualwiper.json - vspec export json ${COMMON_ARGS} -l overlays/extensions/OBD.vspec ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION)_obd.json - -tests: - PYTHONPATH=${TOOLSDIR} pytest + vspec export json ${COMMON_ARGS} -l overlays/profiles/motorbike.vspec ${COMMON_VSPEC_ARG} -o vss_motorbike.json + vspec export json ${COMMON_ARGS} -l overlays/extensions/dual_wiper_systems.vspec ${COMMON_VSPEC_ARG} -o vss_dualwiper.json + vspec export json ${COMMON_ARGS} -l overlays/extensions/OBD.vspec ${COMMON_VSPEC_ARG} -o vss_obd.json binary: - vspec export binary ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).binary + vspec export binary ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.binary protobuf: - vspec export protobuf ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).proto + vspec export protobuf ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.proto graphql: - vspec export graphql ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).graphql.ts + vspec export graphql ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.graphql.ts apigear: vspec export apigear ${COMMON_ARGS} ${COMMON_VSPEC_ARG} --output-dir apigear - cd apigear && tar -czvf ../vss_rel_$$(cat ../VERSION)_apigear.tar.gz * && cd .. + cd apigear && tar -czvf ../vss_apigear.tar.gz * && cd .. samm: vspec export samm ${COMMON_ARGS} ${COMMON_VSPEC_ARG} --target-folder samm - cd samm && tar -czvf ../vss_rel_$$(cat ../VERSION)_samm.tar.gz * && cd .. + cd samm && tar -czvf ../vss_samm.tar.gz * && cd .. # vspec2ttl does not use common generator framework ttl: - ${TOOLSDIR}/contrib/vspec2ttl/vspec2ttl.py -u ./spec/units.yaml ./spec/VehicleSignalSpecification.vspec vss_rel_$$(cat VERSION).ttl + ${TOOLSDIR}/contrib/vspec2ttl/vspec2ttl.py -u ./spec/units.yaml ./spec/VehicleSignalSpecification.vspec vss.ttl id: - vspec export id ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss_rel_$$(cat VERSION).vspec + vspec export id ${COMMON_ARGS} ${COMMON_VSPEC_ARG} -o vss.vspec clean: - rm -f vss_rel_* + rm -f vss.* rm -rf apigear rm -rf samm diff --git a/VERSION b/VERSION deleted file mode 100644 index 51ad0a34c..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0-dev diff --git a/scripts/install_vss_tools.sh b/scripts/install_vss_tools.sh new file mode 100755 index 000000000..4d62bcbb7 --- /dev/null +++ b/scripts/install_vss_tools.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Change this script to specify which version of vss-tools to install. +# It must be a version compatible with the VSS version. +# See https://github.com/COVESA/vss-tools for vss-tools information +# +# To be able to run the script you must have a python/pip environment +# where pip is allowed, for instance a virtual python environment +# , see https://docs.python.org/3/library/venv.html +# +# ************ MASTER *************'' +# For master (ongoing development) we typically rely on latest master of vss-tools +# +pip install git+https://github.com/COVESA/vss-tools@master + +# Examples for other scenarios below +# +# ************ MAINTENANCE ********** +# For development in maintenance branches we could either refer to a fixed version of vss-tools +# or refer to a maintenance branch of vss-tools +# pip install git+https://github.com/COVESA/vss-tools@4.X +# +# +# ************* RELEASE CANDIDATES AND OTHER PRE-RELEASES *************** +# For VSS release candidates we want to link to specified released VSS-tools version. +# Either a released version or a pre-release, referenced with "--pre" +# See https://pypi.org/project/vss-tools/ +# +# pip install --pre vss-tools==5.0.0.dev0 +# +# +# *********************** RELEASES *************************** +# For releases we should link to specific released pypi version. +# +# pip install vss-tools==4.2