From ef64808c5dbffc29952f2d27a2aeb09253aa42f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Thu, 5 Oct 2023 16:46:56 +0300 Subject: [PATCH] GitHub actions - add test run for edge-testnet & version check Just run the edge-testnet, it should pass nicely (as a test). Ensure we keep the versions in sync by checking them with a script. --- .github/workflows/pr-checker.yml | 13 +++++++++++ check_versions.sh | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 check_versions.sh diff --git a/.github/workflows/pr-checker.yml b/.github/workflows/pr-checker.yml index 328f0ef..00b1dd6 100644 --- a/.github/workflows/pr-checker.yml +++ b/.github/workflows/pr-checker.yml @@ -50,3 +50,16 @@ jobs: #- run: git clone https://github.com/PelionIoT/scripts-internal.git - run: echo "." >scripts-internal/.nopyshcheck - run: .github/workflows/pysh-checker.sh ${{ github.event.repository.default_branch }} ${{ github.ref_name }} + + run-edge-testnet: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Run edge-testnet + run: fw-tools/edge-testnet + + versions-check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - run: ./check_versions.sh diff --git a/check_versions.sh b/check_versions.sh new file mode 100755 index 0000000..bdd233f --- /dev/null +++ b/check_versions.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) 2023, Izuma Networks +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://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. + +edgeinfover=$(head -n 32 "edge-info/edge-info" | tail -n 1) +# Use grep with a regular expression to extract the version +if [[ $edgeinfover =~ version=\"([^\"]+)\" ]]; then + extracted_ver="${BASH_REMATCH[1]}" +else + echo "Version not found from line 32 in edge-info/edge-info -file ($edgeinfover)." + exit 1 +fi +devidver=$(head -n 1 "identity-tools/developer_identity/VERSION") +chgver=$(head -n 1 "CHANGELOG.md" | awk '{ for (i=1; i<=NF; i++) if ($i ~ /^[0-9]+\.[0-9]+\.[0-9]+$/) { print $i; exit } }') +echo "ChangeLog version: $chgver" +echo "edge-info version: $extracted_ver" +echo "Identity tool version: $devidver" +if [ "$extracted_ver" != "$devidver" ] || \ + [ "$extracted_ver" != "$chgver" ]; then + echo "Versions do not match! @extracted_ver vs. $devidver vs. $chgver" + echo "Fix required." + exit 1 +else + echo "Versions match." +fi