From c6848e45a1cc2fd32b9a0352e9b7c8729f80feb4 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Mon, 11 Dec 2023 09:48:59 +0800 Subject: [PATCH] Using docker image for nuttx spectest (#2887) And disable running the nuttx spectest CI every time PR merged since it will consume too much runners to slow down the other checks. --- .github/workflows/build_llvm_libraries.yml | 10 ++++- .github/workflows/spec_test_on_nuttx.yml | 52 ++++------------------ 2 files changed, 17 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build_llvm_libraries.yml b/.github/workflows/build_llvm_libraries.yml index 7ef1dd63..a24e340f 100644 --- a/.github/workflows/build_llvm_libraries.yml +++ b/.github/workflows/build_llvm_libraries.yml @@ -11,6 +11,9 @@ on: arch: required: true type: string + container_image: + required: false + type: string outputs: cache_key: description: "A cached key of LLVM libraries" @@ -19,6 +22,10 @@ on: jobs: build_llvm_libraries: runs-on: ${{ inputs.os }} + # Using given container image if it is specified. + # Otherwise, it will be ignored by the runner. + container: + image: ${{ inputs.container_image }} outputs: key: ${{ steps.create_lib_cache_key.outputs.key}} @@ -71,8 +78,9 @@ jobs: 0-ccache-${{ inputs.os }} if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-22.04' + # Don't install dependencies if the cache is hit or running in docker container - run: sudo apt install -y ccache ninja-build - if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu') + if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu') && inputs.container_image == '' - uses: actions/cache@v3 with: diff --git a/.github/workflows/spec_test_on_nuttx.yml b/.github/workflows/spec_test_on_nuttx.yml index 48fff2d2..957f82f3 100644 --- a/.github/workflows/spec_test_on_nuttx.yml +++ b/.github/workflows/spec_test_on_nuttx.yml @@ -6,9 +6,10 @@ name: spec test on nuttx on: pull_request: types: - - closed - branches: - - main + - opened + - synchronize + paths: + - ".github/workflows/spec_test_on_nuttx.yml" schedule: - cron: '0 0 * * *' @@ -27,10 +28,13 @@ jobs: with: os: "ubuntu-22.04" arch: "ARM RISCV AArch64" + container_image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:4b4cbf0b70512e61ada9cdcb76b97e90ad478b85e4d0774d05a95fa32caa8c39 spec_test_on_qemu: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: [build_llvm_libraries] + container: + image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:4b4cbf0b70512e61ada9cdcb76b97e90ad478b85e4d0774d05a95fa32caa8c39 strategy: matrix: target_config: [ @@ -91,32 +95,6 @@ jobs: wamr_test_option: { mode: "-t aot -X" } steps: - - name: Install Utilities - run: | - sudo apt install -y kconfig-frontends-nox genromfs - - - name: Install ARM Compilers - if: startsWith(matrix.target_config.config, 'boards/arm') - run: | - sudo apt install -y gcc-arm-none-eabi - wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz - xz -d gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz - tar xf gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar - echo "$PWD/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin" >> $GITHUB_PATH - - - name: Install RISC-V Compilers - if: startsWith(matrix.target_config.config, 'boards/risc-v') - run: | - curl -L https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v12.3.0-1/xpack-riscv-none-elf-gcc-12.3.0-1-linux-x64.tar.gz > riscv.tar.gz - tar xvf riscv.tar.gz - echo "$PWD/xpack-riscv-none-elf-gcc-12.3.0-1/bin" >> $GITHUB_PATH - - - name: Install WASI-SDK - run: | - curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz > wasi-sdk.tar.gz - tar xvf wasi-sdk.tar.gz - sudo mv wasi-sdk-* /opt/wasi-sdk - - name: Checkout NuttX uses: actions/checkout@v3 with: @@ -190,20 +168,6 @@ jobs: tools/configure.sh ${{ matrix.target_config.config }} make -j$(nproc) echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT - - - name: Install QEMU for ARM - if: startsWith(matrix.target_config.config, 'boards/arm') - run: | - curl -L https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.1.0-1/xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz > xpack-qemu-arm.tar.gz - tar xvf xpack-qemu-arm.tar.gz - echo $PWD/xpack-qemu-arm-7.1.0-1/bin >> $GITHUB_PATH - - - name: Install QEMU for RISC-V - if: startsWith(matrix.target_config.config, 'boards/risc-v') - run: | - curl -L https://github.com/xpack-dev-tools/qemu-riscv-xpack/releases/download/v7.1.0-1/xpack-qemu-riscv-7.1.0-1-linux-x64.tar.gz > xpack-qemu-riscv.tar.gz - tar xvf xpack-qemu-riscv.tar.gz - echo PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin >> $GITHUB_PATH - name: Test run: |