From a82dabc5418a93ec91434d2ce06c5af4979e1108 Mon Sep 17 00:00:00 2001 From: Michal Gorecki Date: Fri, 30 Aug 2024 13:43:25 +0200 Subject: [PATCH] ci: Add ambiguous config test --- .github/targets/ambiguous_fail/pkg.yml | 5 ++ .github/targets/ambiguous_fail/syscfg.yml | 10 +++ .github/targets/ambiguous_fail/target.yml | 3 + .github/targets/ambiguous_success/pkg.yml | 5 ++ .github/targets/ambiguous_success/syscfg.yml | 10 +++ .github/targets/ambiguous_success/target.yml | 3 + .github/workflows/test_ambiguous_cfg.yml | 66 ++++++++++++++++++++ 7 files changed, 102 insertions(+) create mode 100644 .github/targets/ambiguous_fail/pkg.yml create mode 100644 .github/targets/ambiguous_fail/syscfg.yml create mode 100644 .github/targets/ambiguous_fail/target.yml create mode 100644 .github/targets/ambiguous_success/pkg.yml create mode 100644 .github/targets/ambiguous_success/syscfg.yml create mode 100644 .github/targets/ambiguous_success/target.yml create mode 100644 .github/workflows/test_ambiguous_cfg.yml diff --git a/.github/targets/ambiguous_fail/pkg.yml b/.github/targets/ambiguous_fail/pkg.yml new file mode 100644 index 000000000..dba5fd244 --- /dev/null +++ b/.github/targets/ambiguous_fail/pkg.yml @@ -0,0 +1,5 @@ +pkg.name: "targets/ambiguous_fail" +pkg.type: target +pkg.description: +pkg.author: +pkg.homepage: diff --git a/.github/targets/ambiguous_fail/syscfg.yml b/.github/targets/ambiguous_fail/syscfg.yml new file mode 100644 index 000000000..0ff26b6a2 --- /dev/null +++ b/.github/targets/ambiguous_fail/syscfg.yml @@ -0,0 +1,10 @@ +syscfg.vals: + SHELL_PROMPT_MODULE: 1 + SHELL_TASK: 1 + +syscfg.vals.SHELL_PROMPT_MODULE: + CONSOLE_IMPLEMENTATION: stub + +# This should fail +syscfg.vals.SHELL_TASK: + CONSOLE_IMPLEMENTATION: full diff --git a/.github/targets/ambiguous_fail/target.yml b/.github/targets/ambiguous_fail/target.yml new file mode 100644 index 000000000..2d8502089 --- /dev/null +++ b/.github/targets/ambiguous_fail/target.yml @@ -0,0 +1,3 @@ +target.app: "@apache-mynewt-nimble/apps/btshell" +target.bsp: "@apache-mynewt-core/hw/bsp/nordic_pca10056" +target.build_profile: optimized diff --git a/.github/targets/ambiguous_success/pkg.yml b/.github/targets/ambiguous_success/pkg.yml new file mode 100644 index 000000000..f4f8c20d6 --- /dev/null +++ b/.github/targets/ambiguous_success/pkg.yml @@ -0,0 +1,5 @@ +pkg.name: "targets/ambiguous_success" +pkg.type: target +pkg.description: +pkg.author: +pkg.homepage: diff --git a/.github/targets/ambiguous_success/syscfg.yml b/.github/targets/ambiguous_success/syscfg.yml new file mode 100644 index 000000000..c9935d569 --- /dev/null +++ b/.github/targets/ambiguous_success/syscfg.yml @@ -0,0 +1,10 @@ +syscfg.vals: + SHELL_PROMPT_MODULE: 1 + SHELL_TASK: 1 + +syscfg.vals.SHELL_PROMPT_MODULE: + CONSOLE_IMPLEMENTATION: stub + +# This should not fail as it sets the same value as previous conditional config +syscfg.vals.SHELL_TASK: + CONSOLE_IMPLEMENTATION: stub diff --git a/.github/targets/ambiguous_success/target.yml b/.github/targets/ambiguous_success/target.yml new file mode 100644 index 000000000..2d8502089 --- /dev/null +++ b/.github/targets/ambiguous_success/target.yml @@ -0,0 +1,3 @@ +target.app: "@apache-mynewt-nimble/apps/btshell" +target.bsp: "@apache-mynewt-core/hw/bsp/nordic_pca10056" +target.build_profile: optimized diff --git a/.github/workflows/test_ambiguous_cfg.yml b/.github/workflows/test_ambiguous_cfg.yml new file mode 100644 index 000000000..0e347951e --- /dev/null +++ b/.github/workflows/test_ambiguous_cfg.yml @@ -0,0 +1,66 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +name: Test sysinit + +on: [push, pull_request] + +jobs: + test_ambiguous_cfg: + name: other + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 'stable' + - uses: carlosperate/arm-none-eabi-gcc-action@48db4484a55750df7a0ccca63347fcdea6534d78 + with: + release: '12.2.Rel1' + - name: Install Dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y gcc-multilib + - name: Build newt + working-directory: newt + shell: bash + run: | + go version + go build + echo ${GITHUB_WORKSPACE}/newt >> $GITHUB_PATH + - name: Test ambiguous cfg success + shell: bash + run: | + newt new project + cp -r .github/targets/ambiguous_success project/targets + cd project/ + newt upgrade -v + newt build ambiguous_success + - name: Test ambiguous cfg fail + shell: bash + run: | + cp -r .github/targets/ambiguous_fail project/targets + cd project/ + ! newt build ambiguous_fail &> tmp.txt + grep "Error: Setting CONSOLE_IMPLEMENTATION collision - two conditions true:" tmp.txt -q