Skip to content

Get rid of artifacts #102

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

Merged
merged 10 commits into from
Apr 23, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 3 additions & 3 deletions .github/workflows/package_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ jobs:
run: |
./extra/build_all.sh -f

- name: Package
- name: Package core
run: |
./extra/package.sh ${{ env.CORE_TAG }}
./extra/package_core.sh ${{ env.CORE_TAG }}

- name: Archive core
uses: actions/upload-artifact@v4
with:
name: ${{ env.CORE_ARTIFACT }}
path: ${{ env.CORE_ARTIFACT }}.tar.bz2
path: distrib/${{ env.CORE_ARTIFACT }}.tar.bz2

test-core:
name: Test ${{ matrix.board }} board
Expand Down
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
extra/post_build_tool/distrib/
build/
venv/
ArduinoCore-zephyr-*.tar.bz2
/build/
/distrib/
/firmwares/*
/venv/
llext-edk/
cflags.txt
cxxflags.txt
includes.txt
provides.ld
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ mkdir my_new_zephyr_folder && cd my_new_zephyr_folder
git clone https://github.com/arduino/ArduinoCore-zephyr
```
### Pre-requirements
Before running the installation script, ensure that `python3` and `pip` are installed on your system. The script will automatically install `west` and manage the necessary dependencies.
Before running the installation script, ensure that Python, `pip` and `venv` are installed on your system. The script will automatically install `west` and manage the necessary dependencies.

On Ubuntu or similar `apt`-based distros, make sure to run the following command:
```bash
sudo apt install python3-pip python3-setuptools python3-venv build-essential git cmake ninja-build zstd jq
```

### Run the ```bootstrap``` script
```bash
Expand Down
31 changes: 0 additions & 31 deletions extra/package.sh

This file was deleted.

7 changes: 7 additions & 0 deletions extra/package_core.exc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains all the files that must *never* be added to core package
# archives. Excluding a file here has precedence over files listed in the
# 'package.inc' list or automatically included by the 'package.sh' script.

CMakeLists.txt
llext-edk/Makefile.cflags
llext-edk/cmake.cflags
File renamed without changes.
32 changes: 32 additions & 0 deletions extra/package_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

if [ -z "$1" ]; then
echo "Usage: $0 VERSION"
exit 1
fi

if [ ! -f platform.txt ]; then
echo "Launch this script from the root core folder as ./extra/package_core.sh VERSION"
exit 2
fi

PACKAGE=ArduinoCore-zephyr
VERSION=$1

TEMP_LIST=$(mktemp)

# import a basic list of files and directories
cat extra/package_core.inc | sed -e 's/\s*#.*//' | grep -v '^\s*$' > ${TEMP_LIST}

# add the board-specific files
extra/get_board_details.sh | jq -cr '.[]' | while read -r item; do
variant=$(jq -cr '.variant' <<< "$item")
echo "variants/${variant}/" >> ${TEMP_LIST}
ls firmwares/zephyr-${variant}.* >> ${TEMP_LIST}
done
cat ${TEMP_LIST}
mkdir -p distrib
tar -cjhf distrib/${PACKAGE}-${VERSION}.tar.bz2 -X extra/package_core.exc -T ${TEMP_LIST} --transform "s,^,${PACKAGE}/,"
rm -f ${TEMP_LIST}
75 changes: 75 additions & 0 deletions extra/package_tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

set -e

TOOL_NAME=$(basename $1)
VERSION=$2

BASE_DIR=$(readlink -f $(dirname $0)/..)
TOOL_DIR="$BASE_DIR/extra/$TOOL_NAME"
if ! [ -d "$TOOL_DIR" ] || [ -z "$VERSION" ] ; then
echo "Usage: $0 <tool_name> <version>"
exit 1
fi

DIR=${BASE_DIR}/distrib

hash_file() {
plat=$1
file=$2
name=$(basename $file)
hash=$(sha256sum $file | cut -d ' ' -f 1)
len=$(stat -c %s $file)
cat << EOF
{
"host": "$plat",
"url": "https://downloads.arduino.cc/tools/$name",
"archiveFileName": "$name",
"checksum": "SHA-256:$hash",
"size": "$len"
}
EOF
}

build_for_arch() {
local os=$1
local arch=$2
local plat=$3

if [ "$os" == "windows" ]; then
app_ext=".exe"
pkg_ext=".zip"
pkg_cmd="zip -qr"
else
app_ext=""
pkg_ext=".tar.gz"
pkg_cmd="tar -czf"
fi

local tool_stem="$DIR/$TOOL_NAME-$VERSION"
local build_dir="$tool_stem/$plat"
local build_file="$TOOL_NAME$app_ext"
local package_file="$tool_stem-$plat$pkg_ext"

echo "Building $TOOL_NAME for $os/$arch ($plat)"
mkdir -p "$build_dir"
(cd $BASE_DIR/extra/$TOOL_NAME && GOOS="$os" GOARCH="$arch" go build -o "$build_dir/$build_file")
(cd "$tool_stem" && $pkg_cmd "$package_file" $plat/)
hash_file $plat "$package_file" > $build_dir.json
}

build_json() {
temp_file=$(mktemp)
echo "{ \"packages\": [ { \"tools\": [ { \"name\": \"$TOOL_NAME\", \"version\": \"$VERSION\", \"systems\":" > $temp_file
ls $DIR/$TOOL_NAME-$VERSION/*.json | sort | xargs cat | jq -s . >> $temp_file
echo "} ] } ] }" >> $temp_file
jq . $temp_file > $DIR/$TOOL_NAME-$VERSION.json
rm -f $temp_file $DIR/$TOOL_NAME-$VERSION/*.json
}

build_for_arch "linux" "amd64" "x86_64-linux-gnu"
build_for_arch "linux" "arm64" "aarch64-linux-gnu"
build_for_arch "darwin" "amd64" "i386-apple-darwin11"
build_for_arch "windows" "386" "i686-mingw32"
build_json
echo "Build completed for $TOOL_NAME $VERSION: $DIR/$TOOL_NAME-$VERSION.json"
20 changes: 0 additions & 20 deletions extra/post_build_tool/build.sh

This file was deleted.

3 changes: 0 additions & 3 deletions extra/post_build_tool/go.mod

This file was deleted.

Binary file removed extra/post_build_tool/zephyr-post-build-tool
Binary file not shown.
1 change: 1 addition & 0 deletions extra/sync-zephyr-artifacts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sync-zephyr-artifacts
Loading