Skip to content

Commit

Permalink
tests on push; improve the docker image (#57)
Browse files Browse the repository at this point in the history
* tests on push; improve the docker image

* move ci_build and ci_cache out of workdir
  • Loading branch information
rogerlz committed Sep 5, 2023
1 parent e20ba75 commit 9082240
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 41 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/ci-build_test.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
# Perform continuous integration tests on updates and pull requests
name: Build test
on:
pull_request:
types: [synchronize]
push:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
paths:
klippy:
- 'klippy/**'
- 'test/**'
- 'scripts/**'
klipper:
- 'src/**'
- 'lib/**'
- 'test/**'
- id: should_test
if: steps.changes.outputs.paths == 'true' && github.event.review.state == 'approved'
run: |
echo "::set-output name=run_test::true"
- name: Test
if: steps.should_test.outputs.run_test == 'true'
run: docker run ${{ secrets.DOCKERHUB_USERNAME }}/klipper-build:latest "./scripts/ci-build.sh" 2>&1
- name: Test Klippy Only
if: steps.changes.outputs.klippy == 'true' && steps.changes.outputs.klipper == 'false'
run: docker run -v $PWD:/klipper ${{ secrets.DOCKERHUB_USERNAME }}/klipper-build:latest "./scripts/ci-build.sh" 2>&1

- name: Upload micro-controller data dictionaries
if: steps.should_test.outputs.run_test == 'true'
uses: actions/upload-artifact@v2
with:
name: data-dict
path: ci_build/dict
- name: Test Klipper Full
if: steps.changes.outputs.klippy == 'true' && steps.changes.outputs.klipper == 'true'
run: docker run -v $PWD:/klipper ${{ secrets.DOCKERHUB_USERNAME }}/klipper-build:latest "./scripts/ci-build.sh" compile 2>&1
3 changes: 2 additions & 1 deletion scripts/Dockerfile-build
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ COPY . /klipper
WORKDIR /klipper

RUN ./scripts/ci-install.sh
ENV PATH="/klipper/ci_build/python-env/bin:$PATH"
RUN ./scripts/ci-build.sh
ENV PATH="/ci_build/python-env/bin:$PATH"
RUN pip install -r ./scripts/requirements_dev.txt
38 changes: 23 additions & 15 deletions scripts/ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu

# Paths to tools installed by ci-install.sh
MAIN_DIR=${PWD}
BUILD_DIR=${PWD}/ci_build
BUILD_DIR=/ci_build
export PATH=${BUILD_DIR}/pru-gcc/bin:${PATH}
export PATH=${BUILD_DIR}/or1k-linux-musl-cross/bin:${PATH}
PYTHON=${BUILD_DIR}/python-env/bin/python
Expand All @@ -33,22 +33,30 @@ finish_test()
# Run compile tests for several different MCU types
######################################################################

compile()
{
for TARGET in test/configs/*.config ; do
start_test mcu_compile "$TARGET"
make clean
make distclean
unset CC
cp ${TARGET} .config
make olddefconfig
make V=1 -j2
size out/*.elf
finish_test mcu_compile "$TARGET"
cp out/klipper.dict ${1}/$(basename ${TARGET} .config).dict
done
}

DICTDIR=${BUILD_DIR}/dict
mkdir -p ${DICTDIR}

for TARGET in test/configs/*.config ; do
start_test mcu_compile "$TARGET"
make clean
make distclean
unset CC
cp ${TARGET} .config
make olddefconfig
make V=1 -j2
size out/*.elf
finish_test mcu_compile "$TARGET"
cp out/klipper.dict ${DICTDIR}/$(basename ${TARGET} .config).dict
done

if [ ! -d "${DICTDIR}" ]; then
mkdir -p ${DICTDIR}
compile ${DICTDIR}
elif [ ! -z "${1-}" ] && [ $1 == "compile" ]; then
compile ${DICTDIR}
fi

######################################################################
# Verify klippy host software
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
set -eux

MAIN_DIR=${PWD}
BUILD_DIR=${PWD}/ci_build
CACHE_DIR=${PWD}/ci_cache
BUILD_DIR=/ci_build
CACHE_DIR=/ci_cache
mkdir -p ${BUILD_DIR} ${CACHE_DIR}


Expand Down
4 changes: 0 additions & 4 deletions test/configs/atmega328.config

This file was deleted.

0 comments on commit 9082240

Please sign in to comment.