|
| 1 | +name: "Copilot Setup Steps" |
| 2 | + |
| 3 | +# Runs automatically when this file changes (for validation), |
| 4 | +# and can be triggered manually from the Actions tab. |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - .github/workflows/copilot-setup-steps.yml |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - .github/workflows/copilot-setup-steps.yml |
| 13 | + |
| 14 | +jobs: |
| 15 | + # The job MUST be called `copilot-setup-steps`. |
| 16 | + copilot-setup-steps: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Install system dependencies |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install -y \ |
| 30 | + build-essential \ |
| 31 | + python3 \ |
| 32 | + python3-pip \ |
| 33 | + pipx |
| 34 | + pipx ensurepath |
| 35 | +
|
| 36 | + - name: Install Conan |
| 37 | + run: pipx install conan |
| 38 | + |
| 39 | + # Cache the Conan package store so dependency downloads are fast |
| 40 | + # on subsequent agent runs. |
| 41 | + - name: Cache Conan packages |
| 42 | + uses: actions/cache@v4 |
| 43 | + with: |
| 44 | + path: ~/.conan2 |
| 45 | + key: conan-ubuntu-${{ hashFiles('conanfile.txt') }} |
| 46 | + restore-keys: | |
| 47 | + conan-ubuntu- |
| 48 | +
|
| 49 | + - name: Initialise Conan default profile |
| 50 | + run: | |
| 51 | + export PATH="$HOME/.local/bin:$PATH" |
| 52 | + conan profile detect --force |
| 53 | +
|
| 54 | + # Install all declared dependencies (gtest, nlohmann_json) and |
| 55 | + # generate the CMake toolchain file that the build relies on. |
| 56 | + - name: Install Conan dependencies |
| 57 | + run: | |
| 58 | + export PATH="$HOME/.local/bin:$PATH" |
| 59 | + conan install . -of ./build --build missing |
| 60 | +
|
| 61 | + # Pre-configure and pre-build every target so the agent can run |
| 62 | + # tests immediately after making a change with just: |
| 63 | + # cmake --build ./build -j$(nproc) |
| 64 | + - name: Configure and build |
| 65 | + run: | |
| 66 | + export PATH="$HOME/.local/bin:$PATH" |
| 67 | + cmake -S . -B ./build \ |
| 68 | + -DCMAKE_TOOLCHAIN_FILE=./build/conan_toolchain.cmake \ |
| 69 | + -DCUCUMBER_UNDEFINED_STEPS_ARE_A_FAILURE=OFF |
| 70 | + cmake --build ./build -j$(nproc) |
0 commit comments