From 2e3736a558a41eb1bf1dcee916ba562f650a9bfb Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 5 Nov 2023 16:52:45 -0600 Subject: [PATCH 1/2] ci: cache sources --- .github/ci/build.sh | 6 ++++++ d | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/ci/build.sh b/.github/ci/build.sh index ebd672a..fe6ac4d 100755 --- a/.github/ci/build.sh +++ b/.github/ci/build.sh @@ -19,8 +19,14 @@ git remote add upstream https://github.com/embassy-rs/stm32-data git fetch --depth 15 upstream main git clone --depth 1 --branch stm32-data-$(git merge-base HEAD upstream/main) https://github.com/embassy-rs/stm32-data-generated/ build +# move the sources directory out of the cache if it exists +mv /ci/cache/sources ./sources || true + ./d ci +# move the sources directory into the cache +mv ./sources /ci/cache/sources + # upload diff ( cd build diff --git a/d b/d index 5457592..3ba3c08 100755 --- a/d +++ b/d @@ -4,6 +4,7 @@ set -e cd $(dirname $0) CMD=$1 +REV=7b078cef5335129b38245f0a7566103b9245973f shift case "$CMD" in @@ -11,7 +12,7 @@ case "$CMD" in rm -rf ./sources/ git clone https://github.com/embassy-rs/stm32-data-sources.git ./sources/ cd ./sources/ - git checkout 7b078cef5335129b38245f0a7566103b9245973f + git checkout $REV ;; install-chiptool) cargo install --git https://github.com/embassy-rs/chiptool @@ -43,6 +44,10 @@ case "$CMD" in ;; ci) [ -d sources ] || ./d download-all + cd ./sources/ + git fetch origin $REV + git checkout $REV + cd .. rm -rf build/{data,stm32-metapac} cargo run --release --bin stm32-data-gen cargo run --release --bin stm32-metapac-gen From 8ae9a1f2a90bd73ed00d51b355e5790d02db3ea7 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 5 Nov 2023 17:05:25 -0600 Subject: [PATCH 2/2] quiet clones --- .github/ci/build.sh | 2 +- .github/ci/generated.sh | 2 +- d | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ci/build.sh b/.github/ci/build.sh index fe6ac4d..e2ec747 100755 --- a/.github/ci/build.sh +++ b/.github/ci/build.sh @@ -17,7 +17,7 @@ cargo fmt -- --check # so the diff will show this PR's effect git remote add upstream https://github.com/embassy-rs/stm32-data git fetch --depth 15 upstream main -git clone --depth 1 --branch stm32-data-$(git merge-base HEAD upstream/main) https://github.com/embassy-rs/stm32-data-generated/ build +git clone --depth 1 --branch stm32-data-$(git merge-base HEAD upstream/main) https://github.com/embassy-rs/stm32-data-generated/ build -q # move the sources directory out of the cache if it exists mv /ci/cache/sources ./sources || true diff --git a/.github/ci/generated.sh b/.github/ci/generated.sh index 575efed..4d95b59 100755 --- a/.github/ci/generated.sh +++ b/.github/ci/generated.sh @@ -12,7 +12,7 @@ export CARGO_TARGET_DIR=/ci/cache/target hashtime restore /ci/cache/filetime.json || true hashtime save /ci/cache/filetime.json -git clone --depth 1 https://github.com/embassy-rs/stm32-data-generated/ build +git clone --depth 1 https://github.com/embassy-rs/stm32-data-generated/ build -q ./d ci COMMIT=$(git rev-parse HEAD) diff --git a/d b/d index 3ba3c08..a230440 100755 --- a/d +++ b/d @@ -10,7 +10,7 @@ shift case "$CMD" in download-all) rm -rf ./sources/ - git clone https://github.com/embassy-rs/stm32-data-sources.git ./sources/ + git clone https://github.com/embassy-rs/stm32-data-sources.git ./sources/ -q cd ./sources/ git checkout $REV ;;