This commit is contained in:
Dario Nieuwenhuis 2024-01-07 23:54:03 +01:00
parent 59598d3ff8
commit ff1d6a6277

13
.github/ci/build.sh vendored
View File

@ -17,7 +17,10 @@ cargo fmt -- --check
# so the diff will show this PR's effect # so the diff will show this PR's effect
git remote add upstream https://github.com/embassy-rs/stm32-data git remote add upstream https://github.com/embassy-rs/stm32-data
git fetch --depth 15 upstream main git fetch --depth 15 upstream main
set +e
git clone --depth 1 --branch stm32-data-$(git merge-base HEAD upstream/main) https://github.com/embassy-rs/stm32-data-generated/ build -q git clone --depth 1 --branch stm32-data-$(git merge-base HEAD upstream/main) https://github.com/embassy-rs/stm32-data-generated/ build -q
DIFF_OK=$?
set -e
# move the sources directory out of the cache if it exists # move the sources directory out of the cache if it exists
mv /ci/cache/sources ./sources || true mv /ci/cache/sources ./sources || true
@ -27,6 +30,7 @@ mv /ci/cache/sources ./sources || true
# move the sources directory into the cache # move the sources directory into the cache
mv ./sources /ci/cache/sources mv ./sources /ci/cache/sources
if [ $DIFF_OK -eq 0 ]; then
# upload diff # upload diff
( (
cd build cd build
@ -34,6 +38,11 @@ mv ./sources /ci/cache/sources
git diff --staged --color data | aha --black > /ci/artifacts/diff.html git diff --staged --color data | aha --black > /ci/artifacts/diff.html
) )
cat > /ci/comment.md <<EOF
diff: https://ci.embassy.dev/jobs/$(jq -r .id < /ci/job.json)/artifacts/diff.html
EOF
fi
# upload generated data to a fake git repo at # upload generated data to a fake git repo at
# https://ci.embassy.dev/jobs/$ID/artifacts/generated.git # https://ci.embassy.dev/jobs/$ID/artifacts/generated.git
# this allows testing the corresponding embassy-stm32 PR before merging the stm32-data one. # this allows testing the corresponding embassy-stm32 PR before merging the stm32-data one.
@ -47,7 +56,3 @@ mv ./sources /ci/cache/sources
git update-server-info # generate .git/info/refs git update-server-info # generate .git/info/refs
mv .git /ci/artifacts/generated.git mv .git /ci/artifacts/generated.git
) )
cat > /ci/comment.md <<EOF
diff: https://ci.embassy.dev/jobs/$(jq -r .id < /ci/job.json)/artifacts/diff.html
EOF