From 7a42a7a78e7d7d7250c0d1fd3e2a277ebd899b1a Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Fri, 11 Oct 2024 09:28:41 +0100 Subject: [PATCH] Add resusable workflow so we can run the PR testing in different ways We had duplicate ways of doing the same thing, this unifies the building of the PR cache and the running of tests for PRs. This will be expanded in the future to allow more flexibility. Also brought pull_request.yml into the same file as run_pr_tests.yml --- .github/workflows/build_pr_cache.yml | 61 ----------------------- .github/workflows/pull_request.yml | 49 ------------------ .github/workflows/run_pr_tests.yml | 57 ++++++++++++++++----- .github/workflows/run_pr_tests_caller.yml | 36 +++++++++++++ 4 files changed, 80 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/build_pr_cache.yml delete mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/run_pr_tests_caller.yml diff --git a/.github/workflows/build_pr_cache.yml b/.github/workflows/build_pr_cache.yml deleted file mode 100644 index 7f6e29581..000000000 --- a/.github/workflows/build_pr_cache.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Simple workflow for building sccache for PR testing -name: Build cache for PR testing -# Note this will currently create a new sscache file and this must be manually pruned until such time as we have a job -# for this. -on: - # Uncomment to test this path on a pull request - # pull_request: - # paths: - # - '.github/workflows/build_pr_cache.yml' - # - '.github/do_build_ock/**' - push: - branches: - - main - paths: - - '.github/workflows/build_pr_cache.yml' - - '.github/actions/do_build_ock/**' - - '.github/actions/setup_build/**' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -permissions: {} - -jobs: - - build_pr_ock: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - # installs tools, ninja and installs llvm (default 18, RelAssert) and sets up cache - - name: setup-ubuntu - uses: ./.github/actions/setup_build - with: - save: true - llvm_version: 18 - llvm_build_type: RelAssert - - - name: build host x86_64 release - uses: ./.github/actions/do_build_ock - with: - build_type: Release - build_targets: - - - name: build host x86_64 offline - uses: ./.github/actions/do_build_ock - with: - build_type: Release - extra_flags: -DCA_RUNTIME_COMPILER_ENABLED=OFF -DCA_EXTERNAL_CLC=${{ github.workspace }}/build/bin/clc - build_dir: build_offline - assemble_spirv_ll_lit_test_offline: ON - build_targets: - - - name: clean_build - run: - rm -rf ${{ github.workspace }}/build* - - - name: build riscv m1 - uses: ./.github/actions/do_build_ock/do_build_m1 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index a0ef46daa..000000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Pull Request -on: - workflow_dispatch: - pull_request: - paths: - - source/** - - clik/** - - modules/** - - examples/** - - cmake/** - - hal/** - - .github/actions/do_build_ock/** - - .github/actions/setup_build/** - - .github/workflows/pull_request.yml - - CMakeLists.txt -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -jobs: - -############### JOB mr-ubuntu-gcc-x86_64-riscv-fp16-cl3-0-unitcl_vecz: - - mr-ubuntu-gcc-x86_64-riscv-fp16-cl3-0-unitcl_vecz: - runs-on: ubuntu-22.04 - timeout-minutes: 60 - steps: - - name: Checkout repo - uses: actions/checkout@v4.1.0 - - name: setup-ubuntu - uses: ./.github/actions/setup_build - with: - llvm_version: '18' - llvm_build_type: RelAssert - os: ubuntu - - run: echo WORKSPACE is $GITHUB_WORKSPACE && echo PWD is `pwd` && ls -al - - name: build ock - uses: ./.github/actions/do_build_ock - with: - build_targets: check-ock-UnitCL-group-vecz - mux_targets_enable: riscv - mux_compilers_enable: riscv - riscv_enabled: ON - enable_rvv_scalable_vecz_check: ON - enable_rvv_scalable_vp_vecz_check: ON - use_linker: gold - hal_description: RV64GCV_Zfh - hal_refsi_soc: G1 - hal_refsi_thread_mode: WG - debug_support: ON diff --git a/.github/workflows/run_pr_tests.yml b/.github/workflows/run_pr_tests.yml index 048b68ed1..d06c22f59 100644 --- a/.github/workflows/run_pr_tests.yml +++ b/.github/workflows/run_pr_tests.yml @@ -1,22 +1,21 @@ # Simple workflow for running non-documentation PR testing name: Run ock tests for PR testing on: - pull_request: - paths: - - 'source/**' - - 'clik/**' - - 'modules/**' - - 'examples/**' - - 'cmake/**' - - 'hal/**' - - '.github/actions/do_build_ock/**' - - '.github/actions/setup_build/**' - - '.github/workflows/run_pr_tests.yml' - - 'CMakeLists.txt' + workflow_call: + inputs: + update_cache: + required: false + type: boolean + default: false # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - + inputs: + update_cache: + required: false + default: false + type: boolean + permissions: {} concurrency: @@ -39,6 +38,7 @@ jobs: with: llvm_version: 18 llvm_build_type: RelAssert + save: ${{ inputs.update_cache }} # These need to match the configurations of build_pr_cache to use the cache effectively - name: build host x86_64 online release @@ -83,6 +83,7 @@ jobs: with: llvm_version: 18 llvm_build_type: RelAssert + save: ${{ inputs.update_cache }} - name: build riscv M1 uses: ./.github/actions/do_build_ock/do_build_m1 @@ -117,6 +118,7 @@ jobs: clang-format-diff.py -p1 -regex \ "^(?!(.+\\/)*(external|cookie)\\/).*\\.(c|cc|cxx|cpp|h|hh|hxx|hpp)$" -b clang-format + # Based on: mr-windows-msvc-x86_64-llvm-previous-cl3.0-offline run_windows_msvc_x86_64_llvm_latest_cl3_0_offline: runs-on: windows-2019 @@ -163,3 +165,32 @@ jobs: build_dir: ${{ github.workspace }}/build_offline c_compiler: 'cl.exe' cxx_compiler: 'cl.exe' + + # Based on: mr-ubuntu-gcc-x86_64-riscv-fp16-cl3.0-unitcl_vecz + run_ubuntu_gcc_x86_64_riscv_fp16_cl3_0_unitcl_vecz: + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout repo + uses: actions/checkout@v4.1.0 + - name: setup-ubuntu + uses: ./.github/actions/setup_build + with: + llvm_version: '18' + llvm_build_type: RelAssert + os: ubuntu + - run: echo WORKSPACE is $GITHUB_WORKSPACE && echo PWD is `pwd` && ls -al + - name: build ock + uses: ./.github/actions/do_build_ock + with: + build_targets: check-ock-UnitCL-group-vecz + mux_targets_enable: riscv + mux_compilers_enable: riscv + riscv_enabled: ON + enable_rvv_scalable_vecz_check: ON + enable_rvv_scalable_vp_vecz_check: ON + use_linker: gold + hal_description: RV64GCV_Zfh + hal_refsi_soc: G1 + hal_refsi_thread_mode: WG + debug_support: ON diff --git a/.github/workflows/run_pr_tests_caller.yml b/.github/workflows/run_pr_tests_caller.yml new file mode 100644 index 000000000..a40a2951f --- /dev/null +++ b/.github/workflows/run_pr_tests_caller.yml @@ -0,0 +1,36 @@ +# Calling workflow for running PR style tests +name: Run ock tests for PR style testing +on: + pull_request: + paths: + - 'source/**' + - 'clik/**' + - 'modules/**' + - 'examples/**' + - 'cmake/**' + - 'hal/**' + - '.github/actions/do_build_ock/**' + - '.github/actions/setup_build/**' + - '.github/workflows/run_pr_tests.yml' + - 'CMakeLists.txt' + schedule: + # Run Mon-Fri at 7pm + - cron: '00 19 * * 1-5' + +jobs: + run-with-pull: + name: Call PR testing on pull request + if: ${{ github.event_name == 'pull_request' }} + uses: ./.github/workflows/run_pr_tests.yml + with: + update_cache: false + + # Could have multiple here + run-with-cron: + name: Call PR testing on schedule + if: ${{ github.event_name == 'schedule' }} + uses: ./.github/workflows/run_pr_tests.yml + with: + update_cache: true + +# additional ones here for cron and/or push to main - also can be in different file.