diff --git a/.github/workflows/ci-build_test.yaml b/.github/workflows/ci-build_test.yaml index 5660070ad..2d9dfba2b 100644 --- a/.github/workflows/ci-build_test.yaml +++ b/.github/workflows/ci-build_test.yaml @@ -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 diff --git a/scripts/Dockerfile-build b/scripts/Dockerfile-build index 88d3858ed..e17c86aea 100644 --- a/scripts/Dockerfile-build +++ b/scripts/Dockerfile-build @@ -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 diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh index eb58ad3db..555786814 100755 --- a/scripts/ci-build.sh +++ b/scripts/ci-build.sh @@ -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 @@ -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 diff --git a/scripts/ci-install.sh b/scripts/ci-install.sh index 39ec2796d..0195860cc 100755 --- a/scripts/ci-install.sh +++ b/scripts/ci-install.sh @@ -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} diff --git a/test/configs/atmega328.config b/test/configs/atmega328.config deleted file mode 100644 index b231660e2..000000000 --- a/test/configs/atmega328.config +++ /dev/null @@ -1,4 +0,0 @@ -# Base config file for atmega328 -CONFIG_MACH_AVR=y -CONFIG_MACH_atmega328=y -CONFIG_CLOCK_FREQ=16000000