From 72551caa842e46244ec3882f5ddcec1c4222c1e6 Mon Sep 17 00:00:00 2001 From: doodspav Date: Tue, 19 Dec 2023 03:06:01 +0000 Subject: [PATCH] GHI #20 Add second job --- ...t-warning.yml => reusable-test-native.yml} | 9 +--- .github/workflows/reusable-test-qemu.yml | 50 +++++++++++++++++++ .github/workflows/test.yml | 16 +++++- 3 files changed, 66 insertions(+), 9 deletions(-) rename .github/workflows/{reusable-test-warning.yml => reusable-test-native.yml} (87%) create mode 100644 .github/workflows/reusable-test-qemu.yml diff --git a/.github/workflows/reusable-test-warning.yml b/.github/workflows/reusable-test-native.yml similarity index 87% rename from .github/workflows/reusable-test-warning.yml rename to .github/workflows/reusable-test-native.yml index b253ebe0e..ff56a0326 100644 --- a/.github/workflows/reusable-test-warning.yml +++ b/.github/workflows/reusable-test-native.yml @@ -1,4 +1,4 @@ -name: Run Tests with Warnings +name: Run Tests on Native Platforms on: workflow_call: @@ -28,11 +28,6 @@ on: required: true type: string default: '' - patomic_path: - description: 'Source directory of patomic repository' - required: true - type: string - default: '' jobs: warning: @@ -54,8 +49,8 @@ jobs: } # apply function to all inputs + check_input "os" "${{ inputs.os }}" check_input "preset" "${{ inputs.preset }}" check_input "architecture" "${{ inputs.architecture }}" check_input "triple" "${{ inputs.triple }}" check_input "cmake_build_shared" "${{ inputs.cmake_build_shared }}" - check_input "patomic_path" "${{ inputs.patomic_path }}" diff --git a/.github/workflows/reusable-test-qemu.yml b/.github/workflows/reusable-test-qemu.yml new file mode 100644 index 000000000..8b67533fc --- /dev/null +++ b/.github/workflows/reusable-test-qemu.yml @@ -0,0 +1,50 @@ +name: Run Tests on Emulated Platforms + +on: + workflow_call: + inputs: + preset: + description: 'CMake preset used to build patomic and googletest' + required: true + type: string + default: '' + architecture: + description: 'CPU architecture tests are run on, passed to QEMU' + required: true + type: string + default: '' + triple: + description: 'Platform triple to compile for, used to install correct compiler and sysroot' + required: true + type: string + default: '' + cmake_build_shared: + description: 'Determines value of BUILD_SHARED_LIBS for CMake, must be considered a boolean by CMake' + required: true + type: string + default: '' + +jobs: + warning: + runs-on: ubuntu-latest + steps: + - name: Check No Empty Inputs + shell: bash + run: | + # checks input is not empty + check_input() { + input_name="${1}" + input_value="${2}" + if [[ -z "${input_value}" ]]; then + echo "Error: required input '${input_name}' is empty or was not specified." + exit 1 + else + echo "${input_name}: ${input_value}" + fi + } + + # apply function to all inputs + check_input "preset" "${{ inputs.preset }}" + check_input "architecture" "${{ inputs.architecture }}" + check_input "triple" "${{ inputs.triple }}" + check_input "cmake_build_shared" "${{ inputs.cmake_build_shared }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98c294dd7..cd3bbb697 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,11 +15,23 @@ jobs: os: - macos - ubuntu - uses: doodspav/patomic/.github/workflows/reusable-test-warning.yml@feature/ghi-20-inner-stuff + uses: doodspav/patomic/.github/workflows/reusable-test-native.yml@feature/ghi-20-inner-stuff with: os: ${{ matrix.os }} preset: some-preset architecture: some-architecture triple: some-triple cmake_build_shared: ON - patomic_path: some-path + + test-qemu: + strategy: + matrix: + os: + - macos + - ubuntu + uses: doodspav/patomic/.github/workflows/reusable-test-qemu.yml@feature/ghi-20-inner-stuff + with: + preset: some-preset + architecture: some-architecture + triple: some-triple + cmake_build_shared: ON