Skip to content

Commit

Permalink
Add tests for allowed and ignored repos lists
Browse files Browse the repository at this point in the history
  • Loading branch information
m-gorecki committed Jul 11, 2024
1 parent bc267ce commit cdce058
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/newt_upgrade/allowed-ignored/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apache-mynewt-core
apache-mynewt-mcumgr
apache-mynewt-nimble
arm-CMSIS_5
mbedtls
mcuboot
nordic-nrfx
48 changes: 48 additions & 0 deletions .github/newt_upgrade/allowed-ignored/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# 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.
#

project.repositories:
- apache-mynewt-core

repository.apache-mynewt-core:
type: github
vers: 0-dev
user: apache
repo: mynewt-core

repository.tinyusb:
type: github
vers: 0.0.0
user: hathach
repo: tinyusb

project.repositories.allowed:
- apache-mynewt-core
- apache-mynewt-nimble
- apache-mynewt-mcumgr
- mcuboot
- arm-CMSIS_5
- nordic-nrfx
- mbedtls
- stm-cmsis_device_f3
- stm-stm32f3xx_hal_driver

project.repositories.ignored:
- stm-cmsis_device_f3
- stm-stm32f3xx_hal_driver
1 change: 1 addition & 0 deletions .github/newt_upgrade/fail/core-ignored/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: apache-mynewt-core repository must be allowed. Please add it to the allowed list and/or remove it from the ignored list.
30 changes: 30 additions & 0 deletions .github/newt_upgrade/fail/core-ignored/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# 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.
#

project.repositories:
- apache-mynewt-core

repository.apache-mynewt-core:
type: github
vers: 0-dev
user: apache
repo: mynewt-core

project.repositories.ignored:
- apache-mynewt-core
1 change: 1 addition & 0 deletions .github/newt_upgrade/fail/core-not-allowed/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: apache-mynewt-core repository must be allowed. Please add it to the allowed list and/or remove it from the ignored list.
31 changes: 31 additions & 0 deletions .github/newt_upgrade/fail/core-not-allowed/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# 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.
#

project.repositories:
- apache-mynewt-core

repository.apache-mynewt-core:
type: github
vers: 0-dev
user: apache
repo: mynewt-core

project.repositories.allowed:
- apache-mynewt-nimble
- apache-mynewt-mcumgr
36 changes: 36 additions & 0 deletions .github/workflows/test_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,39 @@ jobs:
echo "Checking target ${{ matrix.targets }}"
! newt upgrade &> tmp.txt
cat tmp.txt | tail -n `wc -l < expected.txt` | diff -w expected.txt -
test_upgrade_filters:
name: newt upgrade (filters)
needs: populate-projects
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
projects: ${{ fromJson(needs.populate-projects.outputs.projects_success) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Build newt
working-directory: newt
shell: bash
run: |
go version
go build
echo ${GITHUB_WORKSPACE}/newt >> $GITHUB_PATH
git config --global url."https://github.com/".insteadOf "git@github.com:"
- name: Test upgrade allowed-ignored
shell: bash
working-directory: .github/newt_upgrade/allowed-ignored
run: |
echo "Checking target ${{ matrix.targets }}"
echo "Test initial install"
newt upgrade
newt info | grep mynewt-dummy | diff -w expected.txt -
echo "Checking out repos to origin/master"
for repo in `ls repos`; do git -C repos/"$repo" checkout -q origin/master; done
echo "Test upgrade"
newt upgrade
ls repos | diff -w expected.txt -

0 comments on commit cdce058

Please sign in to comment.