Skip to content

Convert stm32-blink to SwiftPM #157

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
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
47 changes: 32 additions & 15 deletions .github/actions/install-swift/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ description: Installs the Swift specified by a .swift-version file
runs:
using: "composite"
steps:
# - name: "Cache: Swift"
# id: cache-swift
# uses: actions/cache@v4
# with:
# path: "$HOME/.local/share/swiftly"
# key: swift-${{ hashFiles('.swift-version') }}

- name: Setup Environment
shell: bash
run: |
mkdir -p "$HOME/.local/share"

export SWIFTLY_HOME_DIR="$HOME/.local/share/swiftly"
echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> $GITHUB_ENV
echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> $HOME/.bashrc
Expand All @@ -22,18 +17,22 @@ runs:
echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> $GITHUB_ENV
echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> $HOME/.bashrc

export SWIFTLY_TOOLCHAINS_DIR="$HOME/.local/share/swiftly/toolchains"
echo "SWIFTLY_TOOLCHAINS_DIR=$SWIFTLY_TOOLCHAINS_DIR" >> $GITHUB_ENV
echo "SWIFTLY_TOOLCHAINS_DIR=$SWIFTLY_TOOLCHAINS_DIR" >> $HOME/.bashrc

echo "PATH=$SWIFTLY_BIN_DIR:$PATH" >> $GITHUB_ENV
echo "PATH=\$SWIFTLY_BIN_DIR:\$PATH" >> $HOME/.bashrc

- name: "Restore: Swift"
- name: Restore Swift
uses: actions/cache/restore@v4
id: cache-swift
with:
path: "~/.local/share/swiftly"
key: swift-${{ hashFiles('**/.swift-version') }}
key: swift-${{ runner.os }}-${{ hashFiles('**/.swift-version', '.github/actions/install-swift/action.yml') }}

- name: Install `apt` Dependencies
if: steps.cache-swift.outputs.cache-hit != 'true'
if: runner.os == 'Linux' && steps.cache-swift.outputs.cache-hit != 'true'
shell: bash
run: |
SUDO=$(if [[ $EUID -ne 0 ]]; then echo sudo; fi)
Expand All @@ -43,29 +42,47 @@ runs:
DEBIAN_FRONTEND: noninteractive

- name: Install Swiftly
if: steps.cache-swift.outputs.cache-hit != 'true'
if: runner.os == 'Linux' && steps.cache-swift.outputs.cache-hit != 'true'
shell: bash
run: |
SWIFTLY_VERSION=1.0.1
UNAME=$(uname -m)
curl -O "https://download.swift.org/swiftly/linux/swiftly-$UNAME.tar.gz"
tar zxf "swiftly-$UNAME.tar.gz"
SWIFTLY_TGZ=swiftly-$SWIFTLY_VERSION-$UNAME.tar.gz
curl -O "https://download.swift.org/swiftly/linux/$SWIFTLY_TGZ"
tar zxf "$SWIFTLY_TGZ"
./swiftly init \
--skip-install \
--assume-yes \
--quiet-shell-followup \
--no-modify-profile

- name: Install Swiftly
if: runner.os == 'macOS' && steps.cache-swift.outputs.cache-hit != 'true'
shell: bash
run: |
SWIFTLY_VERSION=1.0.1
SWIFTLY_PKG=swiftly-$SWIFTLY_VERSION.pkg
curl -O "https://download.swift.org/swiftly/darwin/$SWIFTLY_PKG"
pkgutil --check-signature $SWIFTLY_PKG
pkgutil --verbose --expand $SWIFTLY_PKG $SWIFTLY_HOME_DIR
tar -C $SWIFTLY_HOME_DIR -xvf $SWIFTLY_HOME_DIR/swiftly-*/Payload
"$SWIFTLY_BIN_DIR/swiftly" init \
--skip-install \
--assume-yes \
--quiet-shell-followup \
--no-modify-profile

- name: Install Swift
if: steps.cache-swift.outputs.cache-hit != 'true'
shell: bash
run: swiftly install --post-install-file ./out.sh

- name: "Save: Swift"
- name: Save Swift
if: steps.cache-swift.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: "~/.local/share/swiftly"
key: swift-${{ hashFiles('**/.swift-version') }}
key: swift-${{ runner.os }}-${{ hashFiles('**/.swift-version', '.github/actions/install-swift/action.yml') }}

- name: Print Swift Version
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-esp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: ESP
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: NuttX
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-rpi-baremetal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Raspberry Pi Baremetal
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-rpi-pico-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Raspberry Pi Pico SDK
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: STM32
name: STM32 ELF

on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand All @@ -15,16 +15,12 @@ jobs:
strategy:
fail-fast: false
matrix:
example: [stm32-blink, stm32-lvgl]
example: [stm32-lvgl]

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Fixup for running locally in act
if: ${{ env.ACT }}
run: echo /opt/acttoolcache/node/18.20.8/x64/bin >> $GITHUB_PATH

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -36,21 +32,13 @@ jobs:
- name: Install Swift
uses: ./.github/actions/install-swift

- name: Set environment variables
run: |
echo "STM_BOARD=STM32F746G_DISCOVERY" >> $GITHUB_ENV

- name: Build ${{ matrix.example }}
working-directory: ${{ matrix.example }}
run: |
if [[ -f ./fetch-dependencies.sh ]]; then
./fetch-dependencies.sh
fi

if [[ -f ./build-elf.sh ]]; then
./build-elf.sh
fi

if [[ -f Makefile ]]; then
make
fi
37 changes: 37 additions & 0 deletions .github/workflows/build-stm32-macho.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: STM32 Macho

on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
build:
name: Build
runs-on: [self-hosted, macos, sequoia, ARM64]

strategy:
fail-fast: false
matrix:
example: [stm32-blink] #, stm32-lcd-logo, stm32-neopixel, stm32-uart-echo]

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install Swift
uses: ./.github/actions/install-swift

- name: Build ${{ matrix.example }}
working-directory: ${{ matrix.example }}
run: make
4 changes: 2 additions & 2 deletions .github/workflows/build-zephyr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Zephyr
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Lint
on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .swiftformatignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
./harmony/*
./stm32-lvgl/*
./stm32-blink/Sources/STM32F7X6/*
./stm32-lcd-logo/Sources/STM32F7X6/*
./stm32-lvgl/*
./stm32-lvgl/Sources/Registers/*
./stm32-neopixel/Sources/STM32F7X6/*
./stm32-uart-echo/Sources/STM32F7X6/*
115 changes: 0 additions & 115 deletions stm32-blink/Board.swift

This file was deleted.

Loading
Loading