Skip to content

Add GitHub Actions

Add GitHub Actions #11

Workflow file for this run

name: Build Pico SDK Examples
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
# Build on Mondays at 9am PST every week
- cron: '0 17 * * 1'
jobs:
build-pico-sdk:
runs-on: ubuntu-22.04
container: swiftlang/swift:nightly-main-jammy
strategy:
fail-fast: false
matrix:
example:
- name: pico-blink-sdk
board: pico
- name: pico-w-blink-sdk
board: pico_w
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install apt dependencies
run: apt-get -qq update && apt-get -qq -y install curl ninja-build python3
- name: Install CMake 3.30.2
run: |
ARCH=`uname -m`
curl -L https://github.com/Kitware/CMake/releases/download/v3.30.2/cmake-3.30.2-linux-$ARCH.tar.gz -O
tar xzf cmake-3.30.2-linux-$ARCH.tar.gz
export PATH="`pwd`/cmake-3.30.2-linux-$ARCH/bin:$PATH"
echo "PATH=$PATH" >> $GITHUB_ENV
cmake --version
- name: Clone Pico SDK
run: |
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git submodule update --init --recursive
cd ..
- name: Download GNU ARM toolchain
run: |
ARCH=`uname -m`
curl -L https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi.tar.xz -O
tar xf arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi.tar.xz
- name: Set Pico environment variables
run: |
ARCH=`uname -m`
echo "PICO_BOARD=${{ matrix.example.board }}" >> $GITHUB_ENV
echo "PICO_SDK_PATH=`pwd`/pico-sdk" >> $GITHUB_ENV
echo "PICO_TOOLCHAIN_PATH=`pwd`/arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi" >> $GITHUB_ENV
- name: Build ${{ matrix.example.name }}
run: |
cd ${{ matrix.example.name }}
cmake -B build -G Ninja .
cmake --build build