Skip to content

Commit

Permalink
ci: adding macos build (#7)
Browse files Browse the repository at this point in the history
Add MacOS dedicated build of Sentry kernel. No matrix build by now, yet
validate that the Sentry kernel can be built on MacOS X operating
system.
The workflow requires some python fixes associated to homebrew usage
(see actions/setup-python#58) due to Github
actions constraints, in the same way mesonbuild does in its macos
workflow.
This part is left to the MacOS X user on a standard development host.
The parseelf.py script is also fixed to user normalized `/usr/bin/env
python3` as shebang
  • Loading branch information
pthierry-ledger authored Aug 2, 2024
2 parents e0c3642 + fe5b5d0 commit 8ce44c3
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 22 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/build.yml → .github/workflows/gnulinux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sentry kernel build
name: Sentry kernel build on GNU/Linux distros

on:
push:
Expand Down Expand Up @@ -59,6 +59,11 @@ jobs:
container:
image: ${{ matrix.operating_system }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: Clone cross-files
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -96,11 +101,7 @@ jobs:
compiler: ${{ env.compiler }}
triple: arm-none-eabi
ref: ${{ env.compiler_version }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
workspace: $GITHUB_WORKSPACE
- name: set safe dir for dunami (to be removed)
run: |
git config --global --add safe.directory '*'
Expand Down Expand Up @@ -132,6 +133,11 @@ jobs:
container:
image: 'mesonbuild/ubuntu-rolling'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: Clone cross-files
uses: actions/checkout@v4
with:
Expand All @@ -154,17 +160,13 @@ jobs:
compiler: gcc
triple: arm-none-eabi
ref: '12.3.Rel1'
workspace: $GITHUB_WORKSPACE
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
targets: thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf
components: clippy,rustfmt
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: set safe dir for dunami (to be removed)
run: |
git config --global --add safe.directory '*'
Expand Down Expand Up @@ -196,6 +198,11 @@ jobs:
container:
image: 'mesonbuild/ubuntu-rolling'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: Clone cross-files
uses: actions/checkout@v4
with:
Expand All @@ -216,11 +223,6 @@ jobs:
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: deploy local deps
run: |
pip install -r requirements.txt
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Sentry kernel build on MacOS X

on:
workflow_dispatch:
push:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# using /home/build as home, as buildbot is using user build. Cache is still in /cache
# This allows the usage of automated ssh key installation step

jobs:
build_u5_macosX:
defaults:
run:
shell: bash
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: unbreak python in github actions
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
# Delete nonsensical PEP 668 breakage. It is the wrong solution to the problem and isn't designed to be
# productive -- only victim blaming -- however it bites particularly badly because this is a container/VM
# See commit 5c479d7a13a518c18ccb4dc3b6bdd7bfc2a9bdb5 for a more thorough analysis.
find /opt/homebrew/Cellar/python* -name EXTERNALLY-MANAGED -print0 | xargs -0 rm -vf
# use python3 from homebrew because it is a valid framework, unlike the actions one:
# https://github.com/actions/setup-python/issues/58
- run: brew install dtc libssh2 curl srecord rustup
- name: Clone cross-files
uses: actions/checkout@v4
with:
ref: 'using-local-dirs'
repository: 'outpost-os/meson-cross-files'
path: crossfiles
- name: Deploy cross-files
run: |
mkdir -p $HOME/.local/share/meson/cross
cp -a $GITHUB_WORKSPACE/crossfiles/*.ini $HOME/.local/share/meson/cross
echo "MESON_CROSS_FILES=$HOME/.local/share/meson/cross" >> $GITHUB_ENV
shell: bash
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
targets: thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf
components: clippy,rustfmt
- name: Setup C toolchain
uses: outpost-os/action-setup-compiler@v1
with:
compiler: gcc
triple: arm-none-eabi
ref: 13.2.Rel1
workspace: ${{ github.workspace }}
- name: set safe dir for dunami (to be removed)
run: |
git config --global --add safe.directory '*'
shell: bash
- name: deploy local deps
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
echo '$HOME/Library/Python/3.12/bin' >> $GITHUB_PATH
- name: defconfig
run: |
defconfig configs/nucleo_u5a5_autotest_defconfig
- name: Meson Build
uses: outpost-os/action-meson@v1
with:
cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'arm-none-eabi-gcc.ini') }}
actions: '["prefetch", "setup", "compile"]'
options: '-Dconfig=.config -Ddts=dts/examples/nucleo_u5a5_autotest.dts -Ddts-include-dirs=dts'
- name: Meson postcheck
if: failure()
run: |
cat builddir/meson-logs/meson-log.txt
8 changes: 4 additions & 4 deletions .github/workflows/proof.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sentry kernel proof
name: Sentry kernel proof with Frama-C

on:
push:
Expand All @@ -20,11 +20,10 @@ jobs:
container: 'pthierry38/framac-runner:29'
timeout-minutes: 60
steps:
- name: checkout repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
fetch-tags: true
set-safe-directory: true
- name: install prerequisites pkg
uses: outpost-os/action-install-pkg@v1
Expand Down Expand Up @@ -57,6 +56,7 @@ jobs:
with:
compiler: gcc
triple: arm-none-eabi
workspace: $GITHUB_WORKSPACE
- name: Install local deps
run: |
pip3 install -r requirements.txt
Expand Down
4 changes: 3 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ fs = import('fs')
pymod = import('python')
ssmod = import('sourceset')

py3 = pymod.find_installation('python3', modules: ['dunamai'])

dunamai = find_program('dunamai', required: true)
py3 = pymod.find_installation('python3')

kconfig_file = meson.current_source_dir() / 'Kconfig'
kconfig_proj = subproject('kconfig', default_options: ['kconfig=@0@'.format(kconfig_file)])
Expand Down
2 changes: 1 addition & 1 deletion tools/parseelf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import os
import sys
Expand Down

0 comments on commit 8ce44c3

Please sign in to comment.