|
| 1 | +on: |
| 2 | + push: |
| 3 | + pull_request: |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + # Prevent running twice for PRs from same repo |
| 8 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name |
| 9 | + name: Build & Test |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 14 | + generator: ["Ninja", "Unix Makefiles"] |
| 15 | + mbedtls: ["mbedtls", ""] |
| 16 | + libusb: ["libusb", ""] |
| 17 | + compile: ["compile", ""] |
| 18 | + exclude: |
| 19 | + - os: 'windows-latest' |
| 20 | + generator: "Unix Makefiles" |
| 21 | + - libusb: "" |
| 22 | + compile: "compile" |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Install dependencies (Windows) |
| 29 | + if: runner.os == 'Windows' |
| 30 | + run: | |
| 31 | + choco install -y .github/workflows/choco_packages.config |
| 32 | + curl -L https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -o libusb.7z |
| 33 | + 7z x libusb.7z -olibusb |
| 34 | + - name: Set LIBUSB_ROOT (Windows) |
| 35 | + if: runner.os == 'Windows' |
| 36 | + shell: bash |
| 37 | + run: echo "LIBUSB_ROOT=$(pwd)/libusb" >> "$GITHUB_ENV" |
| 38 | + |
| 39 | + - name: Install dependencies (macOS) |
| 40 | + if: runner.os == 'macOS' |
| 41 | + run: | |
| 42 | + brew install cmake libusb pkg-config ninja |
| 43 | + brew install --cask gcc-arm-embedded |
| 44 | +
|
| 45 | + - name: Install dependencies (Linux) |
| 46 | + if: runner.os == 'Linux' |
| 47 | + run: sudo apt install cmake ninja-build python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib libusb-1.0-0-dev |
| 48 | + - name: Checkout Pico SDK |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + repository: raspberrypi/pico-sdk |
| 52 | + ref: develop |
| 53 | + path: pico-sdk |
| 54 | + submodules: ${{ !(!matrix.mbedtls) }} |
| 55 | + |
| 56 | + - name: Build and Install |
| 57 | + run: | |
| 58 | + cmake -S . -B build -G "${{ matrix.generator }}" -D PICO_SDK_PATH="${{ github.workspace }}/pico-sdk" ${{ !matrix.libusb && '-D PICOTOOL_NO_LIBUSB=1' || '' }} ${{ matrix.compile && '-D USE_PRECOMPILED=false' || '' }} |
| 59 | + cmake --build build |
| 60 | + ${{ runner.os != 'Windows' && 'sudo' || '' }} cmake --install build |
| 61 | + - name: Add to path (Windows) |
| 62 | + if: runner.os == 'Windows' |
| 63 | + run: echo "C:\Program Files (x86)\picotool\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 64 | + |
| 65 | + - name: Test |
| 66 | + run: | |
| 67 | + picotool help |
| 68 | + curl -L https://datasheets.raspberrypi.com/soft/blink.uf2 -o blink.uf2 |
| 69 | + curl -L https://datasheets.raspberrypi.com/soft/hello_world.uf2 -o hello_world.uf2 |
| 70 | + curl -L https://datasheets.raspberrypi.com/soft/flash_nuke.uf2 -o flash_nuke.uf2 |
| 71 | + picotool info -a blink.uf2 |
| 72 | + picotool info -a hello_world.uf2 |
| 73 | + picotool info -a flash_nuke.uf2 |
0 commit comments