Skip to content

Commit 82459f7

Browse files
authored
Merge pull request #102 from facchinm/get_rid_of_artifacts
Get rid of artifacts
2 parents 2746c8a + 19acd5a commit 82459f7

File tree

17,970 files changed

+845
-9730719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

17,970 files changed

+845
-9730719
lines changed

.github/workflows/package_core.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ jobs:
4747
run: |
4848
./extra/build_all.sh -f
4949
50-
- name: Package
50+
- name: Package core
5151
run: |
52-
./extra/package.sh ${{ env.CORE_TAG }}
52+
./extra/package_core.sh ${{ env.CORE_TAG }}
5353
5454
- name: Archive core
5555
uses: actions/upload-artifact@v4
5656
with:
5757
name: ${{ env.CORE_ARTIFACT }}
58-
path: ${{ env.CORE_ARTIFACT }}.tar.bz2
58+
path: distrib/${{ env.CORE_ARTIFACT }}.tar.bz2
5959

6060
test-core:
6161
name: Test ${{ matrix.board }} board

.gitignore

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
extra/post_build_tool/distrib/
2-
build/
3-
venv/
4-
ArduinoCore-zephyr-*.tar.bz2
1+
/build/
2+
/distrib/
3+
/firmwares/*
4+
/venv/
5+
llext-edk/
6+
cflags.txt
7+
cxxflags.txt
8+
includes.txt
9+
provides.ld

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ mkdir my_new_zephyr_folder && cd my_new_zephyr_folder
106106
git clone https://github.com/arduino/ArduinoCore-zephyr
107107
```
108108
### Pre-requirements
109-
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.
109+
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.
110+
111+
On Ubuntu or similar `apt`-based distros, make sure to run the following command:
112+
```bash
113+
sudo apt install python3-pip python3-setuptools python3-venv build-essential git cmake ninja-build zstd jq
114+
```
110115

111116
### Run the ```bootstrap``` script
112117
```bash

extra/package.sh

-31
This file was deleted.

extra/package_core.exc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file contains all the files that must *never* be added to core package
2+
# archives. Excluding a file here has precedence over files listed in the
3+
# 'package.inc' list or automatically included by the 'package.sh' script.
4+
5+
CMakeLists.txt
6+
llext-edk/Makefile.cflags
7+
llext-edk/cmake.cflags
File renamed without changes.

extra/package_core.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 VERSION"
7+
exit 1
8+
fi
9+
10+
if [ ! -f platform.txt ]; then
11+
echo "Launch this script from the root core folder as ./extra/package_core.sh VERSION"
12+
exit 2
13+
fi
14+
15+
PACKAGE=ArduinoCore-zephyr
16+
VERSION=$1
17+
18+
TEMP_LIST=$(mktemp)
19+
20+
# import a basic list of files and directories
21+
cat extra/package_core.inc | sed -e 's/\s*#.*//' | grep -v '^\s*$' > ${TEMP_LIST}
22+
23+
# add the board-specific files
24+
extra/get_board_details.sh | jq -cr '.[]' | while read -r item; do
25+
variant=$(jq -cr '.variant' <<< "$item")
26+
echo "variants/${variant}/" >> ${TEMP_LIST}
27+
ls firmwares/zephyr-${variant}.* >> ${TEMP_LIST}
28+
done
29+
cat ${TEMP_LIST}
30+
mkdir -p distrib
31+
tar -cjhf distrib/${PACKAGE}-${VERSION}.tar.bz2 -X extra/package_core.exc -T ${TEMP_LIST} --transform "s,^,${PACKAGE}/,"
32+
rm -f ${TEMP_LIST}

extra/package_tool.sh

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
TOOL_NAME=$(basename $1)
6+
VERSION=$2
7+
8+
BASE_DIR=$(readlink -f $(dirname $0)/..)
9+
TOOL_DIR="$BASE_DIR/extra/$TOOL_NAME"
10+
if ! [ -d "$TOOL_DIR" ] || [ -z "$VERSION" ] ; then
11+
echo "Usage: $0 <tool_name> <version>"
12+
exit 1
13+
fi
14+
15+
DIR=${BASE_DIR}/distrib
16+
17+
hash_file() {
18+
plat=$1
19+
file=$2
20+
name=$(basename $file)
21+
hash=$(sha256sum $file | cut -d ' ' -f 1)
22+
len=$(stat -c %s $file)
23+
cat << EOF
24+
{
25+
"host": "$plat",
26+
"url": "https://downloads.arduino.cc/tools/$name",
27+
"archiveFileName": "$name",
28+
"checksum": "SHA-256:$hash",
29+
"size": "$len"
30+
}
31+
EOF
32+
}
33+
34+
build_for_arch() {
35+
local os=$1
36+
local arch=$2
37+
local plat=$3
38+
39+
if [ "$os" == "windows" ]; then
40+
app_ext=".exe"
41+
pkg_ext=".zip"
42+
pkg_cmd="zip -qr"
43+
else
44+
app_ext=""
45+
pkg_ext=".tar.gz"
46+
pkg_cmd="tar -czf"
47+
fi
48+
49+
local tool_stem="$DIR/$TOOL_NAME-$VERSION"
50+
local build_dir="$tool_stem/$plat"
51+
local build_file="$TOOL_NAME$app_ext"
52+
local package_file="$tool_stem-$plat$pkg_ext"
53+
54+
echo "Building $TOOL_NAME for $os/$arch ($plat)"
55+
mkdir -p "$build_dir"
56+
(cd $BASE_DIR/extra/$TOOL_NAME && GOOS="$os" GOARCH="$arch" go build -o "$build_dir/$build_file")
57+
(cd "$tool_stem" && $pkg_cmd "$package_file" $plat/)
58+
hash_file $plat "$package_file" > $build_dir.json
59+
}
60+
61+
build_json() {
62+
temp_file=$(mktemp)
63+
echo "{ \"packages\": [ { \"tools\": [ { \"name\": \"$TOOL_NAME\", \"version\": \"$VERSION\", \"systems\":" > $temp_file
64+
ls $DIR/$TOOL_NAME-$VERSION/*.json | sort | xargs cat | jq -s . >> $temp_file
65+
echo "} ] } ] }" >> $temp_file
66+
jq . $temp_file > $DIR/$TOOL_NAME-$VERSION.json
67+
rm -f $temp_file $DIR/$TOOL_NAME-$VERSION/*.json
68+
}
69+
70+
build_for_arch "linux" "amd64" "x86_64-linux-gnu"
71+
build_for_arch "linux" "arm64" "aarch64-linux-gnu"
72+
build_for_arch "darwin" "amd64" "i386-apple-darwin11"
73+
build_for_arch "windows" "386" "i686-mingw32"
74+
build_json
75+
echo "Build completed for $TOOL_NAME $VERSION: $DIR/$TOOL_NAME-$VERSION.json"

extra/post_build_tool/build.sh

-20
This file was deleted.

extra/post_build_tool/go.mod

-3
This file was deleted.
-2.41 MB
Binary file not shown.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sync-zephyr-artifacts

0 commit comments

Comments
 (0)