name: Build, Test and Deploy (single platform) on: workflow_call: inputs: os: required: true type: string c_compiler: required: true type: string cpp_compiler: required: true type: string build_type: required: true type: string enable_cgb: required: true type: boolean enable_system_time: required: false type: boolean default: true run_unit_tests: required: false type: boolean default: false run_emulation_tests: required: false type: boolean default: false upload_artifact: required: false type: boolean default: false artifact_name: required: false type: string default: ${{ inputs.os }}-${{ inputs.build_type }}-${{ inputs.c_compiler }} artifact_path: required: false type: string jobs: build: runs-on: ${{ inputs.os }} steps: # Checkout and update submodules recursively. - uses: actions/checkout@v6 with: submodules: recursive # Configure project. - name: Configure CMake run: > cmake -B ${{ github.workspace }}/build -DCMAKE_CXX_COMPILER=${{ inputs.cpp_compiler }} -DCMAKE_C_COMPILER=${{ inputs.c_compiler }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DBUILD_TESTS=${{ inputs.run_unit_tests || inputs.run_emulation_tests }} -DENABLE_CGB=${{ inputs.enable_cgb }} -DENABLE_RTC_SYSTEM_TIME=${{ inputs.enable_system_time }} -DSDL_UNIX_CONSOLE_BUILD=ON -S ${{ github.workspace }} # Build project. - name: Build run: cmake --build ${{ github.workspace }}/build --config ${{ inputs.build_type }} --parallel # Run unit tests [optional] - name: Run Unit Tests if: ${{ inputs.run_unit_tests }} run: ctest --build-config ${{ inputs.build_type }} --output-on-failure -R docboy-unit-tests working-directory: ${{ github.workspace }}/build # Run emulation tests [optional] - name: Run Emulation Tests if: ${{ inputs.run_emulation_tests }} run: ctest --build-config ${{ inputs.build_type }} --output-on-failure -R docboy-emulation-tests working-directory: ${{ github.workspace }}/build # Upload artifact [optional] - uses: actions/upload-artifact@v7 if: ${{ inputs.upload_artifact }} with: name: ${{ inputs.artifact_name }} path: ${{ inputs.artifact_path }}