Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions compile test #131

Merged
merged 15 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/choco_packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="gcc-arm-embedded" version="10.2.1" />
<package id="cmake" version="3.25.2" installArguments="ADD_CMAKE_TO_PATH=System" />
<package id="mingw" version="12.2.0" />
<package id="ninja" version="1.11.1" />
</packages>
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
on:
push:
pull_request:

jobs:
build:
# Prevent running twice for PRs from same repo
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Build & Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
generator: ["Ninja", "Unix Makefiles"]
mbedtls: ["mbedtls", ""]
libusb: ["libusb", ""]
compile: ["compile", ""]
exclude:
- os: 'windows-latest'
generator: "Unix Makefiles"
- libusb: ""
compile: "compile"
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install -y .github/workflows/choco_packages.config
curl -L https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -o libusb.7z
7z x libusb.7z -olibusb
- name: Set LIBUSB_ROOT (Windows)
if: runner.os == 'Windows'
shell: bash
run: echo "LIBUSB_ROOT=$(pwd)/libusb" >> "$GITHUB_ENV"

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake libusb pkg-config ninja
brew install --cask gcc-arm-embedded

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
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
- name: Checkout Pico SDK
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: develop
path: pico-sdk
submodules: ${{ !(!matrix.mbedtls) }}

- name: Build and Install
run: |
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' || '' }}
cmake --build build
${{ runner.os != 'Windows' && 'sudo' || '' }} cmake --install build
- name: Add to path (Windows)
if: runner.os == 'Windows'
run: echo "C:\Program Files (x86)\picotool\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Test
run: |
picotool help
curl -L https://datasheets.raspberrypi.com/soft/blink.uf2 -o blink.uf2
curl -L https://datasheets.raspberrypi.com/soft/hello_world.uf2 -o hello_world.uf2
curl -L https://datasheets.raspberrypi.com/soft/flash_nuke.uf2 -o flash_nuke.uf2
picotool info -a blink.uf2
picotool info -a hello_world.uf2
picotool info -a flash_nuke.uf2
4 changes: 3 additions & 1 deletion cmake/FindLIBUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)

if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBUSB libusb-1.0)
else ()
endif()

if (NOT PC_LIBUSB_FOUND)
# As the pkg-config was not found we are probably building under windows.
# Determine the architecture of the host, to choose right library
if (NOT DEFINED ARCHITECTURE)
Expand Down
2 changes: 2 additions & 0 deletions picoboot_flash_id/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.12)

if (NOT USE_PRECOMPILED)
set(PICO_NO_PICOTOOL 1)

# default build type
set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "build type")

Expand Down
2 changes: 2 additions & 0 deletions xip_ram_perms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.12)

if (NOT USE_PRECOMPILED)
set(PICO_PLATFORM rp2350-arm-s)

set(PICO_NO_PICOTOOL 1)

# Pull in SDK (must be before project)
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
Expand Down
Loading