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
30 changes: 30 additions & 0 deletions .github/workflows/build_on_push_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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

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, Build]
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
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ build()
create_debian_package()
{
make package
cp ./*.deb ../ || true
}

cleanup()
Expand Down
74 changes: 39 additions & 35 deletions build_for_ultimaker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,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"

# Make sure to pass an empty argument to make_docker, else any arguments passed to build_for_ultimaker is passed to make_docker instead!
. ./make_docker.sh ""
run_verification="yes"
action="none"

env_check()
{
Expand All @@ -32,25 +29,13 @@ 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
# These tests should never fail!
./run_check_material_profiles.sh || echo "Material Profile Check Failed!"
}

run_linters()
{
run_shellcheck
}

run_shellcheck()
{
docker run \
Expand All @@ -66,24 +51,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 ":chlt" 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)
run_verification="no"
;;
:)
echo "Option -${OPTARG} requires an argument."
Expand All @@ -102,20 +86,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
File renamed without changes.
2 changes: 1 addition & 1 deletion run_check_material_profiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

. ./make_docker.sh
. ./docker_env/make_docker.sh

run_in_docker python3 scripts/check_material_profiles.py || echo "Failed!"

Expand Down