1name: CMake
2on:
3  push:
4    branches-ignore:
5      - 'iar/**'
6  pull_request:
7
8env:
9  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
10  BUILD_TYPE: Release
11
12jobs:
13  build:
14    # cannot specify filter for pull_request in on: above, so do it here
15    if: github.repository_owner == 'raspberrypi' && (github.event_name != 'pull_request' || !startsWith(github.head_ref, 'iar/'))
16    runs-on: [self-hosted, Linux, X64]
17
18    steps:
19    - name: Clean workspace
20      run: |
21        echo "Cleaning up previous run"
22        rm -rf "${{ github.workspace }}"
23        mkdir -p "${{ github.workspace }}"
24
25    - name: Checkout repo
26      uses: actions/checkout@v2
27
28    - name: Checkout submodules
29      run: git submodule update --init
30
31    - name: Create Build Environment
32      # Some projects don't allow in-source building, so create a separate build directory
33      # We'll use this as our working directory for all subsequent commands
34      run: cmake -E make_directory ${{github.workspace}}/build
35
36    - name: Configure CMake
37      # Use a bash shell so we can use the same syntax for environment variable
38      # access regardless of the host operating system
39      shell: bash
40      working-directory: ${{github.workspace}}/build
41      # Note the current convention is to use the -S and -B options here to specify source
42      # and build directories, but this is only available with CMake 3.13 and higher.
43      # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
44      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPICO_SDK_TESTS_ENABLED=1
45
46    - name: Build
47      working-directory: ${{github.workspace}}/build
48      shell: bash
49      # Execute the build.  You can specify a specific target with "--target <NAME>"
50      run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)
51