Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/build_on_push_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build package on Push or Pull Request

on:
push

jobs:
Prepare:
name: 'Prepare'
uses: Ultimaker/embedded-workflows/.github/workflows/prepare_env.yml@main
with:
BUILD_DOCKER_CACHE: true
secrets: inherit

Shellcheck:
name: 'Test'
needs: Prepare
uses: Ultimaker/embedded-workflows/.github/workflows/shellcheck.yml@main
secrets: inherit

Flake8:
name: 'Test'
needs: Prepare
uses: Ultimaker/python-quality-control/.github/workflows/flake8.yml@master
with:
PARENT_BRANCH: 'main'
secrets: inherit

MyPy:
name: 'Test'
needs: Prepare
uses: Ultimaker/python-quality-control/.github/workflows/mypy.yml@master
with:
PARENT_BRANCH: 'main'
secrets: inherit

PyCodeStyle:
name: 'Test'
needs: Prepare
uses: Ultimaker/python-quality-control/.github/workflows/pycodestyle.yml@master
with:
PARENT_BRANCH: 'main'
secrets: inherit

Vulture:
name: 'Test'
needs: Prepare
uses: Ultimaker/python-quality-control/.github/workflows/vulture.yml@master
secrets: inherit

PyTest:
name: 'Test'
needs: Prepare
uses: Ultimaker/python-quality-control/.github/workflows/pytest.yml@master
secrets: inherit

Build:
name: 'Build'
needs: Prepare
uses: Ultimaker/embedded-workflows/.github/workflows/build.yml@main
with:
RELEASE_VERSION: ${{ needs.Prepare.outputs.RELEASE_VERSION }}
secrets: inherit

Release_Package:
name: 'Release'
needs: [Prepare, Shellcheck, Build, Flake8, MyPy, PyCodeStyle, Vulture, PyTest]
if: ${{ (success() && needs.Prepare.outputs.RELEASE_REPO != 'none') ||
(failure() && needs.Build.result == 'success' && needs.Prepare.outputs.RELEASE_REPO == 'packages-dev') }}
uses: Ultimaker/embedded-workflows/.github/workflows/release_pkg.yml@main
with:
RELEASE_REPO: ${{ needs.Prepare.outputs.RELEASE_REPO }}
secrets: inherit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ __pycache__/
# Build folder
_build_armhf/*

# Ignore MyTest data
.pytest_cache/
pstats/

# VIM temp files
*.swp

Expand Down
46 changes: 0 additions & 46 deletions .gitlab-ci.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ci"]
path = ci
url = git@github.com:Ultimaker/python-quality-control.git
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ build()
create_debian_package()
{
make package
cp ./*.deb ../ || true
}

cleanup()
Expand Down
79 changes: 38 additions & 41 deletions build_for_ultimaker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# Copyright (C) 2019 Ultimaker B.V.
#
# SPDX-License-Identifier: LGPL-3.0+

set -eu

Expand All @@ -15,11 +14,8 @@ BUILD_DIR_TEMPLATE="_build_${ARCH}"
BUILD_DIR="${BUILD_DIR:-${SRC_DIR}/${BUILD_DIR_TEMPLATE}}"

run_env_check="yes"
run_linters="yes"
run_tests="yes"

# Run the make_docker.sh script here, within the context of the build_for_ultimaker.sh script
. ./make_docker.sh ""
run_verification="yes"
action="none"

env_check()
{
Expand All @@ -31,25 +27,11 @@ run_build()
run_in_docker "./build.sh" "${@}"
}

deliver_pkg()
{
run_in_docker chown -R "$(id -u):$(id -g)" "${DOCKER_WORK_DIR}"

cp "${BUILD_DIR}/"*".deb" "./"
}

run_tests()
run_verification()
{
echo "Testing!"
# These tests should never fail! See .gitlab-ci.yml
./run_style_analysis.sh || echo "Code Style Analaysis Failed!"
./run_mypy.sh || echo "MYPY Analysis Failed!"
./run_pytest.sh || echo "PyTest failed!"
}

run_linters()
{
run_shellcheck
# These verifications should never fail! See .gitlab-ci.yml
./ci/local/run_all.sh
}

run_shellcheck()
Expand All @@ -67,27 +49,23 @@ usage()
echo "Usage: ${0} [OPTIONS]"
echo " -c Skip build environment checks"
echo " -h Print usage"
echo " -l Skip code linting"
echo " -t Skip tests"
echo " -s Skip code verification"
}

while getopts ":chlst" options; do
while getopts ":a:chls" options; do
case "${options}" in
a)
action="${OPTARG}"
;;
c)
run_env_check="no"
;;
h)
usage
exit 0
;;
l)
run_linters="no"
;;
t)
run_tests="no"
;;
s)
# Ignore for compatibility with other build scripts
run_verification="no"
;;
:)
echo "Option -${OPTARG} requires an argument."
Expand All @@ -106,21 +84,40 @@ if ! command -V docker; then
exit 1
fi

case "${action}" in
shellcheck)
run_shellcheck
exit 0
;;
build)
source ./docker_env/make_docker.sh ""
run_build
exit 0
;;
build_docker_cache)
DOCKER_BUILD_ONLY_CACHE="yes"
source ./docker_env/make_docker.sh ""
exit 0
;;
none)
;;
?)
echo "Invalid action: -${OPTARG}"
exit 1
;;
esac

# Make sure to pass an empty argument to make_docker, else any arguments passed to build_for_ultimaker is passed to make_docker instead!
source ./docker_env/make_docker.sh ""

if [ "${run_env_check}" = "yes" ]; then
env_check
fi

if [ "${run_linters}" = "yes" ]; then
run_linters
fi

run_build "${@}"

if [ "${run_tests}" = "yes" ]; then
run_tests
if [ "${run_verification}" = "yes" ]; then
run_verification
fi

deliver_pkg

exit 0
21 changes: 15 additions & 6 deletions charon_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
typing
pycodestyle
pytest
pytest-cov
flake8==4.0.1
flake8-polyfill==1.0.2
flake8-quotes==3.3.1
mypy==0.910
pep8-naming==0.12.1
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock==1.10.4
pytest-raises==0.11
pytest-profiling==1.7.0
pytest-raises==0.11
vulture==2.3
pycodestyle==2.8.0
pylint==2.13.9
coverage
lizard
vulture
mypy
typing
1 change: 1 addition & 0 deletions ci
Submodule ci added at 58cd8b
8 changes: 0 additions & 8 deletions ci/complexity_analysis.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci/dead_code_analysis.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/mypy.sh

This file was deleted.

17 changes: 0 additions & 17 deletions ci/pytest.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci/style_analysis.sh

This file was deleted.

Loading