From 3d9687dcf043be29e14577550653d041b29bdfc0 Mon Sep 17 00:00:00 2001 From: Piotr Leniec Date: Thu, 3 Dec 2020 14:15:00 +0100 Subject: [PATCH] [DW-18] Optimize CI flow Don't run builds and tests if style check fails and parallelize linux and rt1051 builds --- .github/workflows/main.yml | 91 ++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 456835019a63621877910ac5a5de61ef25e966f9..86aacf9850621481b8c74f79a72e0937f679ea45 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,74 +6,81 @@ jobs: build: runs-on: self-hosted steps: - - name: Check Out - uses: actions/checkout@v2 - with: - token: ${{ secrets.GitHub_PAT }} - submodules: recursive - fetch-depth: 0 - - name: "Copyright notice check" - run: | - config/license_header_check.sh --ci --check-only - - name: "Style checking" - run: | - ./config/style_check_hook.sh --last - - name: "Unit Tests" - run: | - ./configure.sh linux Debug && \ - pushd build-linux-Debug && \ - export JOBS=${JOBS:-`nproc`} &&\ - echo "JOBS=${JOBS}" &&\ - make -j ${JOBS} &&\ - make -j ${JOBS} check && \ - popd - - name: "Check for statics" - run: | - ./tools/find_global_data.py build-linux-Debug/PurePhone.elf - - name: "Build for RT1051" - run: | - ./configure.sh rt1051 Release && \ - pushd build-rt1051-Release && \ - export JOBS=${JOBS:-`nproc`} && \ - echo "JOBS=${JOBS}" && \ - make -j ${JOBS} && \ - popd && \ - uptime - - simulator_tests: - name: simulator tests + - name: build + run: echo "Placeholder for old CI scripts" + check_copyright_and_style: + name: check copyright and style runs-on: self-hosted steps: - name: clone repository uses: actions/checkout@v2 with: + fetch-depth: 0 submodules: recursive + - name: Copyright notice check + run: config/license_header_check.sh --ci --check-only + - name: Style checking + run: ./config/style_check_hook.sh --last - - name: build emulator + build_rt1051_binary: + name: build rt1051 binary + needs: + - check_copyright_and_style + runs-on: self-hosted + steps: + - name: clone repository + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build for RT1051 run: | - ./configure.sh linux Debug && \ - pushd build-linux-Debug && \ + ./configure.sh rt1051 Release && \ + pushd build-rt1051-Release && \ export JOBS=${JOBS:-`nproc`} && \ echo "JOBS=${JOBS}" && \ make -j ${JOBS} && \ popd && \ uptime + build_linux_binary_and_run_tests: + name: build linux binary and run tests + needs: + - check_copyright_and_style + runs-on: self-hosted + steps: + - name: clone repository + uses: actions/checkout@v2 + with: + submodules: recursive + - name: build linux binary + run: | + ./configure.sh linux Debug && \ + pushd build-linux-Debug && \ + export JOBS=${JOBS:-`nproc`} && \ + echo "JOBS=${JOBS}" && \ + make -j ${JOBS} && \ + popd + - name: Check for statics + run: ./tools/find_global_data.py build-linux-Debug/PurePhone.elf + - name: run unit tests + run: | + pushd build-linux-Debug && \ + export JOBS=${JOBS:-`nproc`} && \ + echo "JOBS=${JOBS}" && \ + make -j ${JOBS} check && \ + popd - name: start emulator run: | ./run_emulator_on_filesystem_image.sh 2>&1 > emulator.log & echo $! > emulator.pid - - name: run tests run: pytest ./pytest -rP --port=simulator --timeout=20 -m 'not rt1051' working-directory: test - - name: kill emulator run: | kill $(cat emulator.pid) rm emulator.pid if: always() - - name: print emulator logs run: cat emulator.log if: always()