From 63030e9f78813b52b3ab98f3ccca5fb34893106c Mon Sep 17 00:00:00 2001 From: xychen Date: Wed, 11 May 2022 20:22:45 +0800 Subject: [PATCH] [nanokit] Set up GHA workflows # Conflicts: # .github/workflows/linux.yml --- .github/workflows/build.yml | 42 +++++++++++++++++++ .github/workflows/linux.yml | 79 ----------------------------------- .github/workflows/pr.yml | 68 ------------------------------ .github/workflows/windows.yml | 47 --------------------- 4 files changed, 42 insertions(+), 194 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/linux.yml delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..103ce615c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: 10.3-2021.10 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@master + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Python module + run: pip3 install --user -r requirements.txt + + - name: Compile + run: | + python tools/progen_compile.py -t cmake_gcc_arm -g ninja stm32f103xb_csk6_nanokit_bl stm32f103xb_csk6_nanokit_if + cp projectfiles/make_gcc_arm/*/build/*_if_crc.{bin,hex} . + + - name: Upload test artifacts + uses: actions/upload-artifact@v4 + with: + name: firmware + path: | + *.bin + *.hex diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index 84b11919c..000000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Build DAPLink (Linux) -on: - push: - branches: - - main - - develop - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-22.04 - strategy: - matrix: - gcc: ['10.3-2021.10'] - - steps: - - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: ${{ matrix.gcc }} - path-env-var: ARM_NONE_EABI_GCC_PATH - - - name: Cache Python modules - id: cache-python - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Checkout source files - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install Python module - run: | - pip3 install --user -r requirements.txt - - - name: Install dependencies - run: | - sudo apt install -y ccache ninja-build - export PATH="/usr/lib/ccache:$ARM_NONE_EABI_GCC_PATH:/home/runner/.local/bin:$PATH" - for i in "$ARM_NONE_EABI_GCC_PATH/"* ; do sudo ln -s /usr/bin/ccache /usr/lib/ccache/$(basename $i); done - arm-none-eabi-gcc -v | tee log.txt - (git status; git log -1)>> log.txt - - - name: Cache CCache - id: ccache - uses: actions/cache@v3 - with: - path: .ccache - key: ${{ runner.os }}-gcc-${{ matrix.gcc }}-${{ hashFiles('log.txt') }} - restore-keys: | - ${{ runner.os }}-gcc-${{ matrix.gcc }}- - - - name: Configure CCache - run: | - ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache" - ccache --set-config=max_size=2Gi - ccache -z -s - - - name: Compile - run: | - export PATH="/usr/lib/ccache:$ARM_NONE_EABI_GCC_PATH:/home/runner/.local/bin:$PATH" - python tools/progen_compile.py --release --parallel -v - mkdir bootloaders - cp projectfiles/make_gcc_arm/*_bl/build/*_crc.{bin,hex} bootloaders - (ls -lR firmware_*; ccache -s; arm-none-eabi-gcc -v) | tee log.txt - - - name: Upload test artifacts - uses: actions/upload-artifact@v3 - with: - name: firmware-dev-${{github.run_number}} - path: | - bootloaders/* - firmware*/* - !firmware*/*.zip diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index d9841156c..000000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build DAPLink PR (Linux) -on: - pull_request: - branches: - - main - - develop - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-22.04 - strategy: - matrix: - gcc: ['10.3-2021.10'] - - steps: - - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: ${{ matrix.gcc }} - path-env-var: ARM_NONE_EABI_GCC_PATH - - - name: Cache Python modules - id: cache-python - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Checkout source files - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install Python module - run: | - pip3 install --user -r requirements.txt - - - name: Install dependencies - run: | - sudo apt install -y ccache ninja-build - arm-none-eabi-gcc -v | tee log.txt - (git status; git log -1)>> log.txt - - - name: Cache CCache - id: ccache - uses: actions/cache@v3 - with: - path: .ccache - key: ${{ runner.os }}-gcc-${{ matrix.gcc }}-${{ hashFiles('log.txt') }} - restore-keys: | - ${{ runner.os }}-gcc-${{ matrix.gcc }}- - - - name: Configure CCache - run: | - ccache --set-config=cache_dir="$GITHUB_WORKSPACE/.ccache" - ccache --set-config=max_size=2Gi - ccache -s -z - - - name: Compile - run: | - export PATH="/usr/lib/ccache:$ARM_NONE_EABI_GCC_PATH:/home/runner/.local/bin:$PATH" - progen generate -t cmake_gcc_arm global_workspace - cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -GNinja -S projectfiles/cmake_gcc_arm -B projectfiles/cmake_gcc_arm - ninja -C projectfiles/cmake_gcc_arm - ccache -s diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 69a4cdbd7..000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build DAPLink (Windows) -on: - workflow_dispatch: - -jobs: - build: - runs-on: windows-2019 - strategy: - matrix: - gcc: ['10.3-2021.10'] - - steps: - - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: ${{ matrix.gcc }} - - - name: Cache Python modules - uses: actions/cache@v3 - with: - path: ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Checkout source files - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install Python module - run: | - pip install -r requirements.txt - - - name: Compile - run: | - arm-none-eabi-gcc -v - python tools/progen_compile.py -t cmake_gcc_arm -g mingw-make --release --parallel -v - shell: cmd - - - name: Upload test artifacts - uses: actions/upload-artifact@v3 - with: - name: firmware-dev-${{github.run_number}} - path: | - firmware*/* - !firmware*/*.zip