From 3914a6c8ee19177c72897dc6f2e02da0a3539a9b Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 07:49:27 +0200 Subject: [PATCH 01/10] ci: adding macos build --- .github/workflows/macos.yml | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..99563038 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,76 @@ +name: Sentry kernel build on MacOS + +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: + - 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: install prerequisites pkg + run: | + brew install dtc libssh2 curl srecord rustup + - 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@use-local-dir + with: + compiler: gcc + triple: arm-none-eabi + ref: 13.2.Rel1 + - 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 '*' + shell: bash + - name: deploy local deps + run: | + pip install --upgrade pip + pip install -r requirements.txt + - 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 From 8c66ae916f90c47e152196ce51fd1e34955ffef9 Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 08:18:45 +0200 Subject: [PATCH 02/10] using darwin-dedicated cross-file --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 99563038..badee215 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -67,7 +67,7 @@ jobs: - name: Meson Build uses: outpost-os/action-meson@v1 with: - cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'arm-none-eabi-gcc.ini') }} + cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'darwin-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 From 18891aec55f510d6517d118b860545a549e7be82 Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 08:24:24 +0200 Subject: [PATCH 03/10] ci: macos: fixing barious python constraints on macOS macos: set pip bin name to meson action macos: adding python pip-installed local dir path to PATH meson: dunamai being used as a program, check for program --- .github/workflows/macos.yml | 5 ++++- meson.build | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index badee215..dc54dd52 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -36,6 +36,7 @@ jobs: - name: install prerequisites pkg run: | brew install dtc libssh2 curl srecord rustup + shell: bash - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@v1 with: @@ -61,15 +62,17 @@ jobs: run: | pip install --upgrade pip 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 + uses: outpost-os/action-meson@support-custom-pip-bin-name with: cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'darwin-arm-none-eabi-gcc.ini') }} actions: '["prefetch", "setup", "compile"]' options: '-Dconfig=.config -Ddts=dts/examples/nucleo_u5a5_autotest.dts -Ddts-include-dirs=dts' + pip: 'pip' - name: Meson postcheck if: failure() run: | diff --git a/meson.build b/meson.build index ef4408d0..fef4693c 100644 --- a/meson.build +++ b/meson.build @@ -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)]) From 6d26cc8bcb24f7560179113a7157518a9dc2e656 Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 09:40:34 +0200 Subject: [PATCH 04/10] macos: fixing python using the way meson did --- .github/workflows/macos.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index dc54dd52..ca72135d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -21,6 +21,18 @@ jobs: shell: bash runs-on: macos-latest steps: + - 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: @@ -33,10 +45,6 @@ jobs: 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: install prerequisites pkg - run: | - brew install dtc libssh2 curl srecord rustup - shell: bash - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@v1 with: @@ -60,8 +68,8 @@ jobs: shell: bash - name: deploy local deps run: | - pip install --upgrade pip - pip install -r requirements.txt + 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: | @@ -72,7 +80,7 @@ jobs: cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'darwin-arm-none-eabi-gcc.ini') }} actions: '["prefetch", "setup", "compile"]' options: '-Dconfig=.config -Ddts=dts/examples/nucleo_u5a5_autotest.dts -Ddts-include-dirs=dts' - pip: 'pip' + pip: 'python3 -m pip' - name: Meson postcheck if: failure() run: | From e245bb4b3117430c04641d244ebb86b1c103ddb2 Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 10:13:56 +0200 Subject: [PATCH 05/10] parseelf: fixing shebang with env --- tools/parseelf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/parseelf.py b/tools/parseelf.py index 3f4843e0..ded4469a 100755 --- a/tools/parseelf.py +++ b/tools/parseelf.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import os import sys From 69121e687360de52eb2cdd72c385b71ea884fb7f Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 1 Aug 2024 10:22:29 +0200 Subject: [PATCH 06/10] ci: renaming worklows properly --- .github/workflows/{build.yml => gnulinux.yml} | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/proof.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{build.yml => gnulinux.yml} (99%) diff --git a/.github/workflows/build.yml b/.github/workflows/gnulinux.yml similarity index 99% rename from .github/workflows/build.yml rename to .github/workflows/gnulinux.yml index e6e46361..441e154c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/gnulinux.yml @@ -1,4 +1,4 @@ -name: Sentry kernel build +name: Sentry kernel build on GNU/Linux distros on: push: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index ca72135d..6453d75b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,4 +1,4 @@ -name: Sentry kernel build on MacOS +name: Sentry kernel build on MacOS X on: workflow_dispatch: diff --git a/.github/workflows/proof.yml b/.github/workflows/proof.yml index 47b074cd..a690eb1f 100644 --- a/.github/workflows/proof.yml +++ b/.github/workflows/proof.yml @@ -1,4 +1,4 @@ -name: Sentry kernel proof +name: Sentry kernel proof with Frama-C on: push: From 6d67b5efe042b395be721e259047cf0eb16c05a2 Mon Sep 17 00:00:00 2001 From: pthierry Date: Fri, 2 Aug 2024 12:09:33 +0200 Subject: [PATCH 07/10] fix: using unified cross-file through unified paths --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6453d75b..68f4235e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -77,7 +77,7 @@ jobs: - name: Meson Build uses: outpost-os/action-meson@support-custom-pip-bin-name with: - cross_files: ${{ format('{0}/{1}', env.MESON_CROSS_FILES, 'darwin-arm-none-eabi-gcc.ini') }} + 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' pip: 'python3 -m pip' From f63cb28abfae3026358ec8a5760420ad3e0a286a Mon Sep 17 00:00:00 2001 From: pthierry Date: Fri, 2 Aug 2024 12:33:23 +0200 Subject: [PATCH 08/10] ci: deploy source dir first to allows subdir creation in next steps --- .github/workflows/gnulinux.yml | 30 +++++++++++++++--------------- .github/workflows/macos.yml | 10 +++++----- .github/workflows/proof.yml | 5 ++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/gnulinux.yml b/.github/workflows/gnulinux.yml index 441e154c..821e1dcc 100644 --- a/.github/workflows/gnulinux.yml +++ b/.github/workflows/gnulinux.yml @@ -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: @@ -96,11 +101,6 @@ 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 - name: set safe dir for dunami (to be removed) run: | git config --global --add safe.directory '*' @@ -132,6 +132,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: @@ -160,11 +165,6 @@ jobs: 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 '*' @@ -196,6 +196,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: @@ -216,11 +221,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 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 68f4235e..07b9f6a5 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -21,6 +21,11 @@ jobs: 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 @@ -57,11 +62,6 @@ jobs: compiler: gcc triple: arm-none-eabi ref: 13.2.Rel1 - - 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 '*' diff --git a/.github/workflows/proof.yml b/.github/workflows/proof.yml index a690eb1f..50453567 100644 --- a/.github/workflows/proof.yml +++ b/.github/workflows/proof.yml @@ -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 From 57b3f4d2d43b6a30fce4ee264b227e61d4143b3a Mon Sep 17 00:00:00 2001 From: pthierry Date: Fri, 2 Aug 2024 14:39:10 +0200 Subject: [PATCH 09/10] macos: fix actions version to valid tag --- .github/workflows/macos.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 07b9f6a5..bed8354e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -57,7 +57,7 @@ jobs: targets: thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf components: clippy,rustfmt - name: Setup C toolchain - uses: outpost-os/action-setup-compiler@use-local-dir + uses: outpost-os/action-setup-compiler@v1 with: compiler: gcc triple: arm-none-eabi @@ -75,12 +75,11 @@ jobs: run: | defconfig configs/nucleo_u5a5_autotest_defconfig - name: Meson Build - uses: outpost-os/action-meson@support-custom-pip-bin-name + 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' - pip: 'python3 -m pip' - name: Meson postcheck if: failure() run: | From fe5b5d0c52df4064e658284580b657bdc429fff7 Mon Sep 17 00:00:00 2001 From: pthierry Date: Fri, 2 Aug 2024 15:07:17 +0200 Subject: [PATCH 10/10] ci: fixing GH runners bug when using containers --- .github/workflows/gnulinux.yml | 2 ++ .github/workflows/macos.yml | 1 + .github/workflows/proof.yml | 1 + 3 files changed, 4 insertions(+) diff --git a/.github/workflows/gnulinux.yml b/.github/workflows/gnulinux.yml index 821e1dcc..3f941231 100644 --- a/.github/workflows/gnulinux.yml +++ b/.github/workflows/gnulinux.yml @@ -101,6 +101,7 @@ jobs: compiler: ${{ env.compiler }} triple: arm-none-eabi ref: ${{ env.compiler_version }} + workspace: $GITHUB_WORKSPACE - name: set safe dir for dunami (to be removed) run: | git config --global --add safe.directory '*' @@ -159,6 +160,7 @@ jobs: compiler: gcc triple: arm-none-eabi ref: '12.3.Rel1' + workspace: $GITHUB_WORKSPACE - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@v1 with: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bed8354e..c9cb713c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -62,6 +62,7 @@ jobs: 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 '*' diff --git a/.github/workflows/proof.yml b/.github/workflows/proof.yml index 50453567..3e4998ac 100644 --- a/.github/workflows/proof.yml +++ b/.github/workflows/proof.yml @@ -56,6 +56,7 @@ jobs: with: compiler: gcc triple: arm-none-eabi + workspace: $GITHUB_WORKSPACE - name: Install local deps run: | pip3 install -r requirements.txt