Skip to content

Commit

Permalink
Consolidate how we have build/configure/test commands (project-chip#473)
Browse files Browse the repository at this point in the history
* Cleaning these up

* Cleaning these up

* Cleaning up travis

* adding build scripts (oops gitignore)

* Fixing and updating travis

* Adding mbedTLS tests

* Fixing formatting

* Fixing build

* Trying again
  • Loading branch information
woody-apple authored Apr 23, 2020
1 parent b97ab60 commit 6196e61
Show file tree
Hide file tree
Showing 22 changed files with 109 additions and 94 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# VS Code Configs
.vscode/*
!.vscode/tasks.json
Expand All @@ -13,7 +12,7 @@ Makefile.in
aclocal.m4
autom4te.cache
output/
build/
/build/
examples/**/build
config.log
config.status
Expand Down
64 changes: 29 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,39 @@ language: minimal

branches:
except:
- /^restyled.*$/

services:
- docker
- /^restyled.*$/

before_install:
- ./integrations/ci-tools/pre_build.sh
services:
- docker

script:
- ./integrations/ci-tools/build.sh

after_success:
- ./integrations/ci-tools/post_build_success.sh
- ./integrations/ci-tools/build.sh

# Note: To add new job types, add it to the matrix below, with a unique TASK varable, then update the build.sh to do what you want during that task

jobs:
include:
- stage: Build
name: "Build Ubuntu Linux Xenial LTS"
env: TASK="build-ubuntu-linux"
- stage: Build
name: "Build NRF Example Lock App"
env: TASK="build-nrf-example-lock-app"
- stage: Tests
name: "Unit & Functional Tests"
env: TASK="run-unit-and-functional-tests"
- stage: Tests
name: "Crypto Tests"
env: TASK="run-crypto-tests"
- stage: Tests
name: "Setup Payload Tests"
env: TASK="run-setup-payload-tests"
- stage: Tests
name: "mbedTLS Crypto Tests"
env: TASK="run-mbedtls-crypto-tests"
- stage: Deployment Checks
name: "Run Code Coverage"
env: TASK="run-code-coverage"
- stage: Deployment Checks
name: "Distribution Check"
env: TASK="build-distribution-check"
include:
- stage: Build
name: "Build Ubuntu Linux Xenial LTS"
env: TASK="build-ubuntu-linux"
- stage: Build
name: "Build NRF Example Lock App"
env: TASK="build-nrf-example-lock-app"
- stage: Tests
name: "Unit & Functional Tests"
env: TASK="run-unit-and-functional-tests"
- stage: Tests
name: "Crypto Tests"
env: TASK="run-crypto-tests"
- stage: Tests
name: "Setup Payload Tests"
env: TASK="run-setup-payload-tests"
# - stage: Tests
# name: "mbedTLS Crypto Tests"
# env: TASK="run-mbedtls-crypto-tests"
- stage: Deployment Checks
name: "Run Code Coverage"
env: TASK="run-code-coverage"
- stage: Deployment Checks
name: "Distribution Check"
env: TASK="build-distribution-check"
55 changes: 17 additions & 38 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "Main Build",
"type": "shell",
"command": "make -C build/default",
"command": "scripts/build/default.sh",
"group": {
"kind": "build",
"isDefault": true
Expand All @@ -20,7 +20,7 @@
{
"label": "Auto-enforce coding style",
"type": "shell",
"command": "make -C build/default pretty",
"command": "scripts/helpers/auto_enforce_code_style.sh",
"group": "none",
"dependsOn": "Bootstrap",
"isBackground": false,
Expand All @@ -33,107 +33,86 @@
{
"label": "Verify coding style conformance",
"type": "shell",
"command": "make -C build/default pretty-check",
"command": "scripts/helpers/code_style_check.sh",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Run Unit and Functional Tests",
"type": "shell",
"command": "make -C build/default check",
"command": "scripts/test/all_tests.sh",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Run Distribution Generation",
"type": "shell",
"command": "make -C build/default distcheck",
"command": "scripts/build/distribution_check.sh",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Run Code Coverage",
"type": "shell",
"command": "make -C build/default coverage; code -r build/default/src/chip.info/index.html",
"command": "scripts/tools/codecoverage.sh; code -r build/default/src/chip.info/index.html",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Clean",
"type": "shell",
"command": "make -C build/default distclean",
"command": "scripts/helpers/clean.sh",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Configure",
"type": "shell",
"command": "mkdir -p build/default && (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage)",
"group": "none",
"problemMatcher": ["$gcc"]
},
{
"label": "Bootstrap",
"type": "shell",
"command": [
"if [[ ! -f build/default/config.status ]]; then",
" mkdir -p build/default;",
" (cd build/default && ",
" ../../bootstrap-configure --enable-debug --enable-coverage); ",
"elif [[ configure.ac -nt configure ]]; then",
" ./bootstrap",
"else",
" ./bootstrap -w make;",
"fi"
],
"command": "scripts/build/bootstrap.sh",
"group": "none",
"problemMatcher": ["$gcc"]
},
{
"label": "Clean Tree",
"type": "shell",
"command": "make -f Makefile-bootstrap clean-repos && git clean -Xdf",
"command": "scripts/helpers/clean_tree.sh",
"group": "none",
"problemMatcher": ["$gcc"]
},
{
"label": "Run Setup Payload Tests",
"type": "shell",
"command": "make -C build/default/src/setup_payload check",
"command": "scripts/tests/setup_payload_tests.sh",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": ["$gcc"]
},
{
"label": "Build & Run Crypto Tests",
"type": "shell",
"command": "make -C build/default/src/crypto check",
"command": "scripts/tests/crypt_tests.sh",
"group": "none",
"problemMatcher": ["$gcc"]
},
{
"label": "Build nRF5 Lock App",
"type": "shell",
"command": "make -C examples/lock-app/nrf5",
"command": "scripts/examples/nrf_lock_app.sh",
"group": "none",
"dependsOn": "Clean Tree",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Build openSSL crypto Tests",
"type": "shell",
"command": " make -C build/default/src/crypto/ && make -C build/default/src/crypto/tests/ TestOpenSSLCrypto",
"command": "scripts/tests/openssl_tests.sh",
"group": "none",
"problemMatcher": [
"$gcc"
]
},
],
"problemMatcher": ["$gcc"]
}
]
}
27 changes: 10 additions & 17 deletions integrations/ci-tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ die() {
# move to ToT, I don't work anywhere else
cd "$here/../.." || die 'ack!, where am I?!?'

bootstrap='
if [[ ! -f build/default/config.status ]]; then
mkdir -p build/default;
(cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage);
else
./bootstrap -w make;
fi'
bootstrap='scripts/build/bootstrap.sh'

bootstrap_mbedtls='
git clean -xdf
Expand Down Expand Up @@ -65,44 +59,43 @@ case "$TASK" in
# a build inside our build container
build-ubuntu-linux)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default'
docker_run_bash_command 'scripts/build/default.sh'
;;

build-nrf-example-lock-app)
docker_run_bash_command 'make VERBOSE=1 -C examples/lock-app/nrf5'
docker_run_bash_command 'scripts/examples/nrf_lock_app.sh'
;;

build-distribution-check)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default'
docker_run_bash_command 'scripts/build/distribution_check.sh'
;;

run-unit-and-functional-tests)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default distcheck'
docker_run_bash_command 'scripts/tests/all_tests.sh'
;;

run-code-coverage)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default coverage'
docker_run_bash_command 'scripts/tools/codecoverage.sh'
docker_run_bash_command 'bash <(curl -s https://codecov.io/bash)'
;;

run-crypto-tests)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default/src/crypto check'
docker_run_bash_command 'scripts/tests/crypto_tests.sh'
;;

run-setup-payload-tests)
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default/src/setup_payload check'
docker_run_bash_command 'scripts/tests/setup_payload_tests.sh'
;;

run-mbedtls-crypto-tests)
docker_run_bash_command "$bootstrap_mbedtls"
docker_run_bash_command 'make V=1 -C build/default/third_party/mbedtls'
docker_run_bash_command 'make V=1 -C build/default/src/crypto check'
docker_run_bash_command 'git clean -xdf'
docker_run_bash_command 'scripts/tests/mbedtls_tests.sh'
docker_run_bash_command 'scripts/tests/crypto_tests.sh'
;;

*)
Expand Down
1 change: 0 additions & 1 deletion integrations/ci-tools/post_build_success.sh

This file was deleted.

1 change: 0 additions & 1 deletion integrations/ci-tools/pre_build.sh

This file was deleted.

Empty file modified integrations/github/actions/clang-tidy/run_clang.sh
100644 → 100755
Empty file.
13 changes: 13 additions & 0 deletions scripts/build/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# if [[ ! -f build/default/config.status ]]; then mkdir -p build/default; (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage); else ./bootstrap -w make; fi

if [[ ! -f build/default/config.status ]]; then
mkdir -p build/default
(cd build/default &&
../../bootstrap-configure --enable-debug --enable-coverage)
elif [[ configure.ac -nt configure ]]; then
./bootstrap
else
./bootstrap -w make
fi
3 changes: 3 additions & 0 deletions scripts/build/default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make V=1 -C build/default
3 changes: 3 additions & 0 deletions scripts/build/distribution_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default distcheck
3 changes: 3 additions & 0 deletions scripts/examples/nrf_lock_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C examples/lock-app/nrf5
3 changes: 3 additions & 0 deletions scripts/helpers/auto_enforce_code_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default pretty
3 changes: 3 additions & 0 deletions scripts/helpers/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default distclean
3 changes: 3 additions & 0 deletions scripts/helpers/clean_tree.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -f Makefile-bootstrap clean-repos && git clean -Xdf
3 changes: 3 additions & 0 deletions scripts/helpers/code_style_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default pretty-check
3 changes: 3 additions & 0 deletions scripts/tests/all_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default check
3 changes: 3 additions & 0 deletions scripts/tests/crypto_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default/src/crypto check
3 changes: 3 additions & 0 deletions scripts/tests/mbedtls_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make V=1 -C build/default/third_party/mbedtls
3 changes: 3 additions & 0 deletions scripts/tests/openssl_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default/src/crypto/ && make -C build/default/src/crypto/tests/ TestOpenSSLCrypto
3 changes: 3 additions & 0 deletions scripts/tests/setup_payload_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default/src/setup_payload check
3 changes: 3 additions & 0 deletions scripts/tools/codecoverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make -C build/default coverage
Empty file.

0 comments on commit 6196e61

Please sign in to comment.